Move Time, TimeDelta and TimeTicks into namespace base.
Review URL: http://codereview.chromium.org/7995 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
base
condition_variable.hcondition_variable_posix.cccondition_variable_unittest.cccondition_variable_win.ccfield_trial.ccfield_trial.hhistogram.cchistogram.hhistogram_unittest.ccidletimer_unittest.ccmessage_loop.ccmessage_loop.hmessage_loop_unittest.ccmessage_pump.hmessage_pump_default.ccmessage_pump_default.hmessage_pump_libevent.ccmessage_pump_libevent.hmessage_pump_win.ccmessage_pump_win.hobserver_list_unittest.ccperftimer.hpr_time_unittest.ccspin_wait.hstats_counters.hstats_table_unittest.cctime.cctime.htime_format.cctime_format.htime_posix.cctime_unittest.cctime_unittest_win.cctime_win.cctimer_unittest.cctrace_event.cctracked.cctracked.htracked_objects.cctracked_objects.hwaitable_event.hwaitable_event_generic.ccwaitable_event_unittest.ccwaitable_event_win.ccwatchdog.ccwatchdog.hwatchdog_unittest.cc
chrome
browser
autocomplete
autocomplete.cchistory_contents_provider.cchistory_contents_provider_unittest.cchistory_url_provider.cchistory_url_provider_unittest.ccsearch_provider.ccsearch_provider.h
automation
base_history_model.hbookmarks
bookmark_codec.ccbookmark_model.ccbookmark_model.hbookmark_model_unittest.ccbookmark_table_model_unittest.cc
browser.ccbrowser_shutdown.ccbrowsing_data_remover.ccbrowsing_data_remover.hcache_manager_host.cccache_manager_host.hcache_manager_host_unittest.ccchrome_plugin_host.ccdom_ui
download
download_file.ccdownload_item_model.ccdownload_manager.ccdownload_manager.hsave_package.ccsave_package.h
history
download_database.ccdownload_database.hdownload_types.hexpire_history_backend.ccexpire_history_backend.hexpire_history_backend_unittest.cchistory.cchistory.hhistory_backend.cchistory_backend.hhistory_backend_unittest.cchistory_marshaling.hhistory_querying_unittest.cchistory_types.cchistory_types.hhistory_types_unittest.cchistory_unittest.ccstarred_url_database.ccstarred_url_database.htext_database.cctext_database.htext_database_manager.cctext_database_manager.htext_database_manager_unittest.cctext_database_unittest.ccthumbnail_database.ccthumbnail_database.hthumbnail_database_unittest.ccurl_database.ccurl_database_unittest.ccvisit_database.ccvisit_database.hvisit_database_unittest.ccvisitsegment_database.ccvisitsegment_database.h
history_model.cchistory_model.hhistory_view.ccie7_password.himporter
firefox2_importer.ccfirefox2_importer.hfirefox3_importer.ccfirefox3_importer.hfirefox_importer_unittest.ccie_importer.ccimporter.hmork_reader.cc
ipc_status_view.ccjankometer.ccload_notification_details.hmetrics_log.ccmetrics_log.hmetrics_log_unittest.ccmetrics_service.ccmetrics_service.hnavigation_controller_unittest.ccnet
dns_global.ccdns_host_info.ccdns_host_info.hdns_host_info_unittest.ccdns_master.ccdns_master.hdns_master_unittest.cc
password_form_manager.ccprinting
print_job.ccprint_view_manager.ccprinted_document.ccprinting_layout_uitest.ccwin_printing_context.cc
profile.ccprofile.hrender_view_host.ccrender_widget_helper.ccrender_widget_helper.hrender_widget_host.ccrender_widget_host.hrender_widget_host_view_win.ccrender_widget_host_view_win.hresource_dispatcher_host.ccresource_dispatcher_host.hsafe_browsing
protocol_manager.ccprotocol_manager.hprotocol_manager_unittest.ccsafe_browsing_database.ccsafe_browsing_database.hsafe_browsing_database_bloom.ccsafe_browsing_database_bloom.hsafe_browsing_database_impl.ccsafe_browsing_database_impl.hsafe_browsing_database_impl_unittest.ccsafe_browsing_database_unittest.ccsafe_browsing_service.ccsafe_browsing_service.h
session_backend.ccsession_service.ccsession_service_test_helper.ccspellchecker.cctab_restore_service.cctab_restore_service.htemplate_url.htemplate_url_model.cctemplate_url_model.htemplate_url_model_unittest.cctemplate_url_prepopulate_data.ccurl_fetcher_protect.ccurl_fetcher_protect.hurl_fetcher_unittest.ccviews
bookmark_editor_view.ccbookmark_editor_view_unittest.ccclear_browsing_data.ccconstrained_window_impl.ccdownload_item_view.ccdownload_tab_view.ccexternal_protocol_dialog.hpage_info_window.ccshelf_item_dialog.cc
visitedlink_perftest.ccweb_contents.ccweb_contents.htabs
toolbar_star_toggle.cctoolbar_star_toggle.hwebdata
common
animation.ccchrome_plugin_lib.ccipc_logging.ccipc_message_utils.hipc_sync_channel.cc
net
thumbnail_score.ccthumbnail_score.htime_format.cctime_format.htime_format_unittest.ccrenderer
test
tools
profiles
views
net
base
client_socket_pool.cccookie_monster.cccookie_monster.hcookie_monster_unittest.ccnet_util.ccsdch_manager.ccsdch_manager.hssl_config_service.ccssl_config_service.hssl_config_service_unittest.ccx509_certificate.hx509_certificate_mac.ccx509_certificate_unittest.ccx509_certificate_win.cc
disk_cache
backend_impl.ccbackend_impl.hbackend_unittest.ccblock_files.ccblock_files_unittest.ccdisk_cache.hdisk_cache_perftest.ccdisk_cache_test_util.ccentry_impl.ccentry_impl.hentry_unittest.ccmem_backend_impl.ccmem_backend_impl.hmem_entry_impl.ccmem_entry_impl.hrankings.ccstress_cache.cc
http
http_cache.cchttp_cache_unittest.cchttp_network_transaction.cchttp_response_headers.cchttp_response_headers.hhttp_response_headers_unittest.cchttp_response_info.hhttp_transaction_unittest.hhttp_transaction_winhttp.cc
proxy
tools
crash_cache
url_request
webkit
default_plugin
glue
port
platform
chromium
tools
@ -80,7 +80,7 @@ class ConditionVariable {
|
||||
// Wait() releases the caller's critical section atomically as it starts to
|
||||
// sleep, and the reacquires it when it is signaled.
|
||||
void Wait();
|
||||
void TimedWait(const TimeDelta& max_time);
|
||||
void TimedWait(const base::TimeDelta& max_time);
|
||||
|
||||
// Broadcast() revives all waiting threads.
|
||||
void Broadcast();
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include "base/lock_impl.h"
|
||||
#include "base/logging.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
ConditionVariable::ConditionVariable(Lock* user_lock)
|
||||
: user_mutex_(user_lock->lock_impl()->os_lock()) {
|
||||
int rv = pthread_cond_init(&condition_, NULL);
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "base/spin_wait.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
namespace {
|
||||
//------------------------------------------------------------------------------
|
||||
// Define our test class, with several common variables.
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "base/lock.h"
|
||||
#include "base/logging.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
ConditionVariable::ConditionVariable(Lock* user_lock)
|
||||
: user_lock_(*user_lock),
|
||||
run_state_(RUNNING),
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/rand_util.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FieldTrialList methods and members.
|
||||
|
||||
|
@ -70,11 +70,11 @@ class FieldTrialList : NonThreadSafe {
|
||||
// of the application. In some experiments it may be useful to discount
|
||||
// data that is gathered before the application has reach sufficient
|
||||
// stability (example: most DLL have loaded, etc.)
|
||||
static Time application_start_time() {
|
||||
static base::Time application_start_time() {
|
||||
if (global_)
|
||||
return global_->application_start_time_;
|
||||
// For testing purposes only, or when we don't yet have a start time.
|
||||
return Time::Now();
|
||||
return base::Time::Now();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -86,7 +86,7 @@ class FieldTrialList : NonThreadSafe {
|
||||
static FieldTrialList* global_; // The singleton of this class.
|
||||
static int constructor_count_; // Prevent having more than one.
|
||||
|
||||
Time application_start_time_;
|
||||
base::Time application_start_time_;
|
||||
RegistrationList registered_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/string_util.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
typedef Histogram::Count Count;
|
||||
|
||||
// static
|
||||
|
@ -44,8 +44,8 @@
|
||||
// These macros all use 50 buckets.
|
||||
|
||||
#define HISTOGRAM_TIMES(name, sample) do { \
|
||||
static Histogram counter((name), TimeDelta::FromMilliseconds(1), \
|
||||
TimeDelta::FromSeconds(10), 50); \
|
||||
static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
|
||||
base::TimeDelta::FromSeconds(10), 50); \
|
||||
counter.AddTime(sample); \
|
||||
} while (0)
|
||||
|
||||
@ -103,16 +103,16 @@
|
||||
static const int kUmaTargetedHistogramFlag = 0x1;
|
||||
|
||||
#define UMA_HISTOGRAM_TIMES(name, sample) do { \
|
||||
static Histogram counter((name), TimeDelta::FromMilliseconds(1), \
|
||||
TimeDelta::FromSeconds(10), 50); \
|
||||
static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
|
||||
base::TimeDelta::FromSeconds(10), 50); \
|
||||
counter.SetFlags(kUmaTargetedHistogramFlag); \
|
||||
counter.AddTime(sample); \
|
||||
} while (0)
|
||||
|
||||
// Use this macro when times can routinely be much longer than 10 seconds.
|
||||
#define UMA_HISTOGRAM_LONG_TIMES(name, sample) do { \
|
||||
static Histogram counter((name), TimeDelta::FromMilliseconds(1), \
|
||||
TimeDelta::FromHours(1), 50); \
|
||||
static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
|
||||
base::TimeDelta::FromHours(1), 50); \
|
||||
counter.SetFlags(kUmaTargetedHistogramFlag); \
|
||||
counter.AddTime(sample); \
|
||||
} while (0)
|
||||
@ -191,8 +191,8 @@ class Histogram : public StatsRate {
|
||||
|
||||
Histogram(const wchar_t* name, Sample minimum,
|
||||
Sample maximum, size_t bucket_count);
|
||||
Histogram(const wchar_t* name, TimeDelta minimum,
|
||||
TimeDelta maximum, size_t bucket_count);
|
||||
Histogram(const wchar_t* name, base::TimeDelta minimum,
|
||||
base::TimeDelta maximum, size_t bucket_count);
|
||||
virtual ~Histogram();
|
||||
|
||||
// Hooks to override stats counter methods. This ensures that we gather all
|
||||
@ -330,8 +330,8 @@ class LinearHistogram : public Histogram {
|
||||
};
|
||||
LinearHistogram(const wchar_t* name, Sample minimum,
|
||||
Sample maximum, size_t bucket_count);
|
||||
LinearHistogram(const wchar_t* name, TimeDelta minimum,
|
||||
TimeDelta maximum, size_t bucket_count);
|
||||
LinearHistogram(const wchar_t* name, base::TimeDelta minimum,
|
||||
base::TimeDelta maximum, size_t bucket_count);
|
||||
~LinearHistogram() {}
|
||||
|
||||
// Store a list of number/text values for use in rendering the histogram.
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "base/time.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace {
|
||||
|
||||
class HistogramTest : public testing::Test {
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "base/message_loop.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::IdleTimer;
|
||||
|
||||
namespace {
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include "base/message_pump_glib.h"
|
||||
#endif
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
// A lazily created thread local storage for quick access to a thread's message
|
||||
// loop, if one exists. This should be safe and free of static constructors.
|
||||
static base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr(
|
||||
|
@ -256,10 +256,10 @@ class MessageLoop : public base::MessagePump::Delegate {
|
||||
|
||||
// This structure is copied around by value.
|
||||
struct PendingTask {
|
||||
Task* task; // The task to run.
|
||||
Time delayed_run_time; // The time when the task should be run.
|
||||
int sequence_num; // Used to facilitate sorting by run time.
|
||||
bool nestable; // True if OK to dispatch from a nested loop.
|
||||
Task* task; // The task to run.
|
||||
base::Time delayed_run_time; // The time when the task should be run.
|
||||
int sequence_num; // Used to facilitate sorting by run time.
|
||||
bool nestable; // True if OK to dispatch from a nested loop.
|
||||
|
||||
PendingTask(Task* task, bool nestable)
|
||||
: task(task), sequence_num(0), nestable(nestable) {
|
||||
@ -334,7 +334,7 @@ class MessageLoop : public base::MessagePump::Delegate {
|
||||
|
||||
// base::MessagePump::Delegate methods:
|
||||
virtual bool DoWork();
|
||||
virtual bool DoDelayedWork(Time* next_delayed_work_time);
|
||||
virtual bool DoDelayedWork(base::Time* next_delayed_work_time);
|
||||
virtual bool DoIdleWork();
|
||||
|
||||
// Start recording histogram info about events and action IF it was enabled
|
||||
|
@ -15,6 +15,8 @@
|
||||
#endif
|
||||
|
||||
using base::Thread;
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
// TODO(darin): Platform-specific MessageLoop tests should be grouped together
|
||||
// to avoid chopping this file up with so many #ifdefs.
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "base/ref_counted.h"
|
||||
|
||||
class Time;
|
||||
|
||||
namespace base {
|
||||
|
||||
class Time;
|
||||
|
||||
class MessagePump : public RefCountedThreadSafe<MessagePump> {
|
||||
public:
|
||||
// Please see the comments above the Run method for an illustration of how
|
||||
@ -120,4 +120,3 @@ class MessagePump : public RefCountedThreadSafe<MessagePump> {
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_MESSAGE_PUMP_H_
|
||||
|
||||
|
@ -75,4 +75,3 @@ void MessagePumpDefault::ScheduleDelayedWork(const Time& delayed_work_time) {
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@ -38,4 +38,3 @@ class MessagePumpDefault : public MessagePump {
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_MESSAGE_PUMP_DEFAULT_H_
|
||||
|
||||
|
@ -179,4 +179,3 @@ void MessagePumpLibevent::ScheduleDelayedWork(const Time& delayed_work_time) {
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@ -86,4 +86,3 @@ class MessagePumpLibevent : public MessagePump {
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_MESSAGE_PUMP_LIBEVENT_H_
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "base/histogram.h"
|
||||
#include "base/win_util.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace {
|
||||
|
||||
class HandlerData : public base::MessagePumpForIO::Watcher {
|
||||
|
@ -249,4 +249,3 @@ class MessagePumpForIO : public MessagePumpWin {
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_MESSAGE_PUMP_WIN_H_
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "base/ref_counted.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace {
|
||||
|
||||
class ObserverListTest : public testing::Test {
|
||||
|
@ -31,16 +31,16 @@ void LogPerfResult(const char* test_name, double value, const char* units);
|
||||
class PerfTimer {
|
||||
public:
|
||||
PerfTimer() {
|
||||
begin_ = TimeTicks::Now();
|
||||
begin_ = base::TimeTicks::Now();
|
||||
}
|
||||
|
||||
// Returns the time elapsed since object construction
|
||||
TimeDelta Elapsed() const {
|
||||
return TimeTicks::Now() - begin_;
|
||||
base::TimeDelta Elapsed() const {
|
||||
return base::TimeTicks::Now() - begin_;
|
||||
}
|
||||
|
||||
private:
|
||||
TimeTicks begin_;
|
||||
base::TimeTicks begin_;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "base/time.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace {
|
||||
|
||||
// time_t representation of 15th Oct 2007 12:45:00 PDT
|
||||
|
@ -31,14 +31,15 @@
|
||||
// that the test passes, even if load varies, and external events vary.
|
||||
|
||||
#define SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(expression) \
|
||||
SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromSeconds(1), (expression))
|
||||
SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(base::TimeDelta::FromSeconds(1), \
|
||||
(expression))
|
||||
|
||||
#define SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(delta, expression) do { \
|
||||
Time start = Time::Now(); \
|
||||
const TimeDelta kTimeout = delta; \
|
||||
base::Time start = base::Time::Now(); \
|
||||
const base::TimeDelta kTimeout = delta; \
|
||||
while(!(expression)) { \
|
||||
if (kTimeout < Time::Now() - start) { \
|
||||
EXPECT_LE((Time::Now() - start).InMilliseconds(), \
|
||||
if (kTimeout < base::Time::Now() - start) { \
|
||||
EXPECT_LE((base::Time::Now() - start).InMilliseconds(), \
|
||||
kTimeout.InMilliseconds()) << "Timed out"; \
|
||||
break; \
|
||||
} \
|
||||
@ -48,4 +49,3 @@
|
||||
while(0)
|
||||
|
||||
#endif // BASE_SPIN_WAIT_H__
|
||||
|
||||
|
@ -187,15 +187,15 @@ class StatsCounterTimer : protected StatsCounter {
|
||||
void Start() {
|
||||
if (!Enabled())
|
||||
return;
|
||||
start_time_ = TimeTicks::Now();
|
||||
stop_time_ = TimeTicks();
|
||||
start_time_ = base::TimeTicks::Now();
|
||||
stop_time_ = base::TimeTicks();
|
||||
}
|
||||
|
||||
// Stop the timer and record the results.
|
||||
void Stop() {
|
||||
if (!Enabled() || !Running())
|
||||
return;
|
||||
stop_time_ = TimeTicks::Now();
|
||||
stop_time_ = base::TimeTicks::Now();
|
||||
Record();
|
||||
}
|
||||
|
||||
@ -205,12 +205,12 @@ class StatsCounterTimer : protected StatsCounter {
|
||||
}
|
||||
|
||||
// Accept a TimeDelta to increment.
|
||||
virtual void AddTime(TimeDelta time) {
|
||||
virtual void AddTime(base::TimeDelta time) {
|
||||
Add(static_cast<int>(time.InMilliseconds()));
|
||||
}
|
||||
|
||||
// TODO(jar) temporary hack include method till base and chrome use new name.
|
||||
void IncrementTimer(TimeDelta time) {
|
||||
void IncrementTimer(base::TimeDelta time) {
|
||||
AddTime(time);
|
||||
}
|
||||
|
||||
@ -220,8 +220,8 @@ class StatsCounterTimer : protected StatsCounter {
|
||||
AddTime(stop_time_ - start_time_);
|
||||
}
|
||||
|
||||
TimeTicks start_time_;
|
||||
TimeTicks stop_time_;
|
||||
base::TimeTicks start_time_;
|
||||
base::TimeTicks stop_time_;
|
||||
};
|
||||
|
||||
// A StatsRate is a timer that keeps a count of the number of intervals added so
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
using base::TimeTicks;
|
||||
|
||||
namespace {
|
||||
class StatsTableTest : public MultiProcessTest {
|
||||
};
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
// TimeDelta ------------------------------------------------------------------
|
||||
|
||||
// static
|
||||
@ -120,3 +122,4 @@ bool Time::FromString(const wchar_t* time_string, Time* parsed_time) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
||||
class Time;
|
||||
class TimeTicks;
|
||||
|
||||
@ -438,4 +440,6 @@ inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
|
||||
return TimeTicks(t.ticks_ + delta_);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_TIME_H_
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "base/time.h"
|
||||
#include "unicode/datefmt.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace {
|
||||
|
||||
std::wstring TimeFormat(const DateFormat* formatter,
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class Time;
|
||||
|
||||
namespace base {
|
||||
|
||||
class Time;
|
||||
|
||||
// Returns the time of day, e.g., "3:07 PM".
|
||||
std::wstring TimeFormatTimeOfDay(const Time& time);
|
||||
|
||||
@ -38,4 +38,3 @@ std::wstring TimeFormatFriendlyDate(const Time& time);
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_TIME_FORMAT_H_
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "base/basictypes.h"
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
// The Time routines in this file use standard POSIX routines, or almost-
|
||||
// standard routines in the case of timegm. We need to use a Mach-specific
|
||||
// function for TimeTicks::Now() on Mac OS X.
|
||||
@ -140,3 +142,5 @@ TimeTicks TimeTicks::Now() {
|
||||
TimeTicks TimeTicks::HighResNow() {
|
||||
return Now();
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
@ -9,6 +9,10 @@
|
||||
#include "build/build_config.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
// Test conversions to/from time_t and exploding/unexploding.
|
||||
TEST(Time, TimeT) {
|
||||
// C library time and exploded time.
|
||||
|
@ -9,6 +9,10 @@
|
||||
#include "base/time.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
namespace {
|
||||
|
||||
class MockTimeTicks : public TimeTicks {
|
||||
|
@ -47,6 +47,10 @@
|
||||
#include "base/singleton.h"
|
||||
#include "base/system_monitor.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
namespace {
|
||||
|
||||
// From MSDN, FILETIME "Contains a 64-bit value representing the number of
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "base/timer.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace {
|
||||
|
||||
class OneShotTimerTester {
|
||||
|
@ -150,4 +150,3 @@ void TraceLog::Log(const std::string& msg) {
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "base/string_util.h"
|
||||
#include "base/tracked_objects.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace tracked_objects {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -116,7 +116,7 @@ class Tracked {
|
||||
// The time this object was constructed. If its life consisted of a long
|
||||
// waiting period, and then it became active, then this value is generally
|
||||
// reset before the object begins it active life.
|
||||
Time tracked_birth_time_;
|
||||
base::Time tracked_birth_time_;
|
||||
|
||||
#endif // TRACK_ALL_TASK_OBJECTS
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include "base/string_util.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace tracked_objects {
|
||||
|
||||
// A TLS slot to the TrackRegistry for the current thread.
|
||||
|
@ -80,11 +80,11 @@ class DeathData {
|
||||
// a corrosponding death.
|
||||
explicit DeathData(int count) : count_(count), square_duration_(0) {}
|
||||
|
||||
void RecordDeath(const TimeDelta& duration);
|
||||
void RecordDeath(const base::TimeDelta& duration);
|
||||
|
||||
// Metrics accessors.
|
||||
int count() const { return count_; }
|
||||
TimeDelta life_duration() const { return life_duration_; }
|
||||
base::TimeDelta life_duration() const { return life_duration_; }
|
||||
int64 square_duration() const { return square_duration_; }
|
||||
int AverageMsDuration() const;
|
||||
double StandardDeviation() const;
|
||||
@ -99,7 +99,7 @@ class DeathData {
|
||||
|
||||
private:
|
||||
int count_; // Number of destructions.
|
||||
TimeDelta life_duration_; // Sum of all lifetime durations.
|
||||
base::TimeDelta life_duration_; // Sum of all lifetime durations.
|
||||
int64 square_duration_; // Sum of squares in milliseconds.
|
||||
};
|
||||
|
||||
@ -128,7 +128,7 @@ class Snapshot {
|
||||
const std::string DeathThreadName() const;
|
||||
|
||||
int count() const { return death_data_.count(); }
|
||||
TimeDelta life_duration() const { return death_data_.life_duration(); }
|
||||
base::TimeDelta life_duration() const { return death_data_.life_duration(); }
|
||||
int64 square_duration() const { return death_data_.square_duration(); }
|
||||
int AverageMsDuration() const { return death_data_.AverageMsDuration(); }
|
||||
|
||||
@ -339,7 +339,7 @@ class ThreadData {
|
||||
Births* FindLifetime(const Location& location);
|
||||
|
||||
// Find a place to record a death on this thread.
|
||||
void TallyADeath(const Births& lifetimes, const TimeDelta& duration);
|
||||
void TallyADeath(const Births& lifetimes, const base::TimeDelta& duration);
|
||||
|
||||
// (Thread safe) Get start of list of instances.
|
||||
static ThreadData* first();
|
||||
|
@ -14,10 +14,10 @@ typedef void* HANDLE;
|
||||
#include "base/lock.h"
|
||||
#endif
|
||||
|
||||
class TimeDelta;
|
||||
|
||||
namespace base {
|
||||
|
||||
class TimeDelta;
|
||||
|
||||
// A WaitableEvent can be a useful thread synchronization tool when you want to
|
||||
// allow one thread to wait for another thread to finish some work.
|
||||
//
|
||||
@ -80,4 +80,3 @@ class WaitableEvent {
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_WAITABLE_EVENT_H_
|
||||
|
||||
|
@ -69,4 +69,3 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "base/waitable_event.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
using base::WaitableEvent;
|
||||
|
||||
namespace {
|
||||
|
@ -63,4 +63,3 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include "base/platform_thread.h"
|
||||
#include "base/string_util.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public API methods.
|
||||
|
||||
@ -145,4 +148,3 @@ Lock Watchdog::static_lock_; // Lock for access of static data...
|
||||
TimeTicks Watchdog::last_debugged_alarm_time_ = TimeTicks();
|
||||
// static
|
||||
TimeDelta Watchdog::last_debugged_alarm_delay_;
|
||||
|
||||
|
@ -28,15 +28,15 @@ class Watchdog {
|
||||
public:
|
||||
// TODO(JAR)change default arg to required arg after all users have migrated.
|
||||
// Constructor specifies how long the Watchdog will wait before alarming.
|
||||
Watchdog(const TimeDelta& duration,
|
||||
Watchdog(const base::TimeDelta& duration,
|
||||
const std::wstring& thread_watched_name,
|
||||
bool enabled = true);
|
||||
virtual ~Watchdog();
|
||||
|
||||
// Start timing, and alarm when time expires (unless we're disarm()ed.)
|
||||
void Arm(); // Arm starting now.
|
||||
void ArmSomeTimeDeltaAgo(const TimeDelta& time_delta);
|
||||
void ArmAtStartTime(const TimeTicks start_time);
|
||||
void ArmSomeTimeDeltaAgo(const base::TimeDelta& time_delta);
|
||||
void ArmAtStartTime(const base::TimeTicks start_time);
|
||||
|
||||
// Reset time, and do not set off the alarm.
|
||||
void Disarm();
|
||||
@ -60,12 +60,12 @@ class Watchdog {
|
||||
Lock lock_; // Mutex for state_.
|
||||
ConditionVariable condition_variable_;
|
||||
State state_;
|
||||
const TimeDelta duration_; // How long after start_time_ do we alarm?
|
||||
const base::TimeDelta duration_; // How long after start_time_ do we alarm?
|
||||
const std::wstring thread_watched_name_;
|
||||
HANDLE handle_; // Handle for watchdog thread.
|
||||
DWORD thread_id_; // Also for watchdog thread.
|
||||
|
||||
TimeTicks start_time_; // Start of epoch, and alarm after duration_.
|
||||
base::TimeTicks start_time_; // Start of epoch, and alarm after duration_.
|
||||
|
||||
// When the debugger breaks (when we alarm), all the other alarms that are
|
||||
// armed will expire (also alarm). To diminish this effect, we track any
|
||||
@ -75,9 +75,9 @@ class Watchdog {
|
||||
// on alarms from callers that specify old times.
|
||||
static Lock static_lock_; // Lock for access of static data...
|
||||
// When did we last alarm and get stuck (for a while) in a debugger?
|
||||
static TimeTicks last_debugged_alarm_time_;
|
||||
static base::TimeTicks last_debugged_alarm_time_;
|
||||
// How long did we sit on a break in the debugger?
|
||||
static TimeDelta last_debugged_alarm_delay_;
|
||||
static base::TimeDelta last_debugged_alarm_delay_;
|
||||
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(Watchdog);
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "base/time.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
// AutocompleteInput ----------------------------------------------------------
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "chrome/browser/profile.h"
|
||||
#include "net/base/net_util.h"
|
||||
|
||||
using base::TimeTicks;
|
||||
|
||||
namespace {
|
||||
|
||||
// Number of days to search for full text results. The longer this is, the more
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include "chrome/test/testing_profile.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace {
|
||||
|
||||
struct TestEntry {
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "googleurl/src/url_util.h"
|
||||
#include "net/base/net_util.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
HistoryURLProviderParams::HistoryURLProviderParams(
|
||||
const AutocompleteInput& input,
|
||||
bool trim_http,
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include "chrome/test/testing_profile.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
struct TestURLInfo {
|
||||
std::wstring url;
|
||||
std::wstring title;
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
const int SearchProvider::kQueryDelayMs = 200;
|
||||
|
||||
void SearchProvider::Start(const AutocompleteInput& input,
|
||||
|
@ -116,7 +116,7 @@ class SearchProvider : public AutocompleteProvider,
|
||||
// algorithms for the different types of matches.
|
||||
int CalculateRelevanceForWhatYouTyped() const;
|
||||
// |time| is the time at which this query was last seen.
|
||||
int CalculateRelevanceForHistory(const Time& time) const;
|
||||
int CalculateRelevanceForHistory(const base::Time& time) const;
|
||||
// |suggestion_value| is which suggestion this is in the list returned from
|
||||
// the server; the best suggestion is suggestion number 0.
|
||||
int CalculateRelevanceForSuggestion(size_t suggestion_value) const;
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "net/base/cookie_monster.h"
|
||||
#include "net/url_request/url_request_filter.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
class InitialLoadObserver : public NotificationObserver {
|
||||
public:
|
||||
InitialLoadObserver(size_t tab_count, AutomationProvider* automation)
|
||||
|
@ -52,11 +52,11 @@ public:
|
||||
switch (type) {
|
||||
case NOTIFY_NAV_ENTRY_COMMITTED:
|
||||
last_navigation_times_[Source<NavigationController>(source).ptr()] =
|
||||
Time::Now();
|
||||
base::Time::Now();
|
||||
return;
|
||||
case NOTIFY_EXTERNAL_TAB_CLOSED:
|
||||
case NOTIFY_TAB_CLOSING:
|
||||
std::map<NavigationController*, Time>::iterator iter =
|
||||
std::map<NavigationController*, base::Time>::iterator iter =
|
||||
last_navigation_times_.find(
|
||||
Source<NavigationController>(source).ptr());
|
||||
if (iter != last_navigation_times_.end())
|
||||
@ -66,22 +66,22 @@ public:
|
||||
AutomationResourceTracker::Observe(type, source, details);
|
||||
}
|
||||
|
||||
Time GetLastNavigationTime(int handle) {
|
||||
base::Time GetLastNavigationTime(int handle) {
|
||||
if (ContainsHandle(handle)) {
|
||||
NavigationController* controller = GetResource(handle);
|
||||
if (controller) {
|
||||
std::map<NavigationController*, Time>::const_iterator iter =
|
||||
std::map<NavigationController*, base::Time>::const_iterator iter =
|
||||
last_navigation_times_.find(controller);
|
||||
if (iter != last_navigation_times_.end())
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
return Time();
|
||||
return base::Time();
|
||||
}
|
||||
|
||||
private:
|
||||
// Last time a navigation occurred.
|
||||
std::map<NavigationController*, Time> last_navigation_times_;
|
||||
std::map<NavigationController*, base::Time> last_navigation_times_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AutomationTabTracker);
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ class BaseHistoryModel {
|
||||
virtual int GetItemCount() = 0;
|
||||
|
||||
// Returns the time of the visit with the given index.
|
||||
virtual Time GetVisitTime(int index) = 0;
|
||||
virtual base::Time GetVisitTime(int index) = 0;
|
||||
|
||||
// Returns the title at the specified index.
|
||||
virtual const std::wstring& GetTitle(int index) = 0;
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// Key names.
|
||||
static const wchar_t* kRootsKey = L"roots";
|
||||
static const wchar_t* kRootFolderNameKey = L"bookmark_bar";
|
||||
@ -193,4 +195,3 @@ bool BookmarkCodec::DecodeNode(BookmarkModel* model,
|
||||
Time::FromInternalValue(StringToInt64(date_added_string));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace {
|
||||
|
||||
// Functions used for sorting.
|
||||
|
@ -69,11 +69,11 @@ class BookmarkNode : public views::TreeNode<BookmarkNode> {
|
||||
}
|
||||
|
||||
// Returns the time the bookmark/group was added.
|
||||
Time date_added() const { return date_added_; }
|
||||
base::Time date_added() const { return date_added_; }
|
||||
|
||||
// Returns the last time the group was modified. This is only maintained
|
||||
// for folders (including the bookmark and other folder).
|
||||
Time date_group_modified() const { return date_group_modified_; }
|
||||
base::Time date_group_modified() const { return date_group_modified_; }
|
||||
|
||||
// Convenience for testing if this nodes represents a group. A group is
|
||||
// a node whose type is not URL.
|
||||
@ -114,10 +114,10 @@ class BookmarkNode : public views::TreeNode<BookmarkNode> {
|
||||
history::StarredEntry::Type type_;
|
||||
|
||||
// Date we were created.
|
||||
Time date_added_;
|
||||
base::Time date_added_;
|
||||
|
||||
// Time last modified. Only used for groups.
|
||||
Time date_group_modified_;
|
||||
base::Time date_group_modified_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BookmarkNode);
|
||||
};
|
||||
@ -292,7 +292,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService {
|
||||
int index,
|
||||
const std::wstring& title,
|
||||
const GURL& url,
|
||||
const Time& creation_time);
|
||||
const base::Time& creation_time);
|
||||
|
||||
// This is the convenience that makes sure the url is starred or not starred.
|
||||
// If is_starred is false, all bookmarks for URL are removed. If is_starred is
|
||||
@ -373,7 +373,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService {
|
||||
bool IsValidIndex(BookmarkNode* parent, int index, bool allow_end);
|
||||
|
||||
// Sets the date modified time of the specified node.
|
||||
void SetDateGroupModified(BookmarkNode* parent, const Time time);
|
||||
void SetDateGroupModified(BookmarkNode* parent, const base::Time time);
|
||||
|
||||
// Creates the bookmark bar/other nodes. These call into
|
||||
// CreateRootNodeFromStarredEntry.
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include "chrome/views/tree_node_model.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
class BookmarkModelTest : public testing::Test, public BookmarkModelObserver {
|
||||
public:
|
||||
struct ObserverDetails {
|
||||
|
@ -10,6 +10,9 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
// Base class for bookmark model tests.
|
||||
// Initial state of the bookmark model is as follows:
|
||||
// bb
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include "chromium_strings.h"
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
static BrowserList g_browserlist;
|
||||
|
||||
// How long we wait before updating the browser chrome while loading a page.
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include "chrome/browser/plugin_service.h"
|
||||
#include "net/dns_global.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace browser_shutdown {
|
||||
|
||||
Time shutdown_started_;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "webkit/glue/password_form.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// Done so that we can use invokeLater on BrowsingDataRemovers and not have
|
||||
// BrowsingDataRemover implement RefCounted.
|
||||
void RunnableMethodTraits<BrowsingDataRemover>::RetainCallee(
|
||||
@ -200,4 +202,3 @@ void BrowsingDataRemover::ClearCacheOnIOThread(Time delete_begin,
|
||||
ui_loop->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowsingDataRemover::ClearedCache));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@ class BrowsingDataRemover : public NotificationObserver {
|
||||
|
||||
// Creates a BrowsingDataRemover to remove browser data from the specified
|
||||
// profile in the specified time range. Use Remove to initiate the removal.
|
||||
BrowsingDataRemover(Profile* profile, Time delete_begin, Time delete_end);
|
||||
BrowsingDataRemover(Profile* profile, base::Time delete_begin,
|
||||
base::Time delete_end);
|
||||
~BrowsingDataRemover();
|
||||
|
||||
// Removes the specified items related to browsing.
|
||||
@ -64,8 +65,8 @@ class BrowsingDataRemover : public NotificationObserver {
|
||||
void ClearedCache();
|
||||
|
||||
// Invoked on the IO thread to delete from the cache.
|
||||
void ClearCacheOnIOThread(Time delete_begin,
|
||||
Time delete_end,
|
||||
void ClearCacheOnIOThread(base::Time delete_begin,
|
||||
base::Time delete_end,
|
||||
MessageLoop* ui_loop);
|
||||
|
||||
// Returns true if we're all done.
|
||||
@ -78,10 +79,10 @@ class BrowsingDataRemover : public NotificationObserver {
|
||||
Profile* profile_;
|
||||
|
||||
// Start time to delete from.
|
||||
const Time delete_begin_;
|
||||
const base::Time delete_begin_;
|
||||
|
||||
// End time to delete to.
|
||||
const Time delete_end_;
|
||||
const base::Time delete_end_;
|
||||
|
||||
// True if Remove has been invoked.
|
||||
bool removing_;
|
||||
@ -104,4 +105,3 @@ class BrowsingDataRemover : public NotificationObserver {
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H__
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "chrome/common/pref_service.h"
|
||||
#include "chrome/common/notification_service.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
static const unsigned int kReviseAllocationDelayMS = 200 /* milliseconds */;
|
||||
|
||||
// The default size limit of the in-memory cache is 8 MB
|
||||
|
@ -68,12 +68,12 @@ class CacheManagerHost {
|
||||
|
||||
protected:
|
||||
// The amount of idle time before we consider a tab to be "inactive"
|
||||
static const TimeDelta kRendererInactiveThreshold;
|
||||
static const base::TimeDelta kRendererInactiveThreshold;
|
||||
|
||||
// Keep track of some renderer information.
|
||||
struct RendererInfo : CacheManager::UsageStats {
|
||||
// The access time for this renderer.
|
||||
Time access;
|
||||
base::Time access;
|
||||
};
|
||||
|
||||
typedef std::map<int, RendererInfo> StatsMap;
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webkit/glue/cache_manager.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
class CacheManagerHostTest : public testing::Test {
|
||||
protected:
|
||||
typedef CacheManagerHost::StatsMap StatsMap;
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include "net/base/base64.h"
|
||||
#include "skia/include/SkBitmap.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
// This class manages the interception of network requests. It queries the
|
||||
// plugin on every request, and creates an intercept job if the plugin can
|
||||
// intercept the request.
|
||||
@ -755,4 +757,3 @@ void CPHandleCommand(int command, CPCommandInterface* data,
|
||||
NewRunnableFunction(PluginCommandHandler::HandleCommand,
|
||||
command, data, context_as_int32));
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include "chromium_strings.h"
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
// The URL scheme used for the new tab.
|
||||
static const char kNewTabUIScheme[] = "chrome-internal";
|
||||
|
||||
@ -823,4 +827,3 @@ void NewTabUIContents::RequestOpenURL(const GURL& url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "net/base/net_util.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
// Throttle updates to the UI thread so that a fast moving download doesn't
|
||||
// cause it to become unresponsive (ins milliseconds).
|
||||
static const int kUpdatePeriodMs = 500;
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
DownloadItemModel::DownloadItemModel(DownloadItem* download)
|
||||
: download_(download) {
|
||||
}
|
||||
|
@ -41,6 +41,9 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
// Periodically update our observers.
|
||||
class DownloadItemUpdateTask : public Task {
|
||||
public:
|
||||
@ -1323,4 +1326,3 @@ void DownloadManager::OnSearchComplete(HistoryService::Handle handle,
|
||||
|
||||
requestor->SetDownloads(searched_downloads);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class DownloadItem {
|
||||
int path_uniquifier,
|
||||
const std::wstring& url,
|
||||
const std::wstring& original_name,
|
||||
const Time start_time,
|
||||
const base::Time start_time,
|
||||
int64 download_size,
|
||||
int render_process_id,
|
||||
int request_id,
|
||||
@ -149,7 +149,7 @@ class DownloadItem {
|
||||
// |*remaining| with the amount of time remaining if successful. Fails and
|
||||
// returns false if we do not have the number of bytes or the speed so can
|
||||
// not estimate.
|
||||
bool TimeRemaining(TimeDelta* remaining) const;
|
||||
bool TimeRemaining(base::TimeDelta* remaining) const;
|
||||
|
||||
// Simple speed estimate in bytes/s
|
||||
int64 CurrentSpeed() const;
|
||||
@ -178,7 +178,7 @@ class DownloadItem {
|
||||
void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; }
|
||||
int64 received_bytes() const { return received_bytes_; }
|
||||
int32 id() const { return id_; }
|
||||
Time start_time() const { return start_time_; }
|
||||
base::Time start_time() const { return start_time_; }
|
||||
void set_db_handle(int64 handle) { db_handle_ = handle; }
|
||||
int64 db_handle() const { return db_handle_; }
|
||||
DownloadManager* manager() const { return manager_; }
|
||||
@ -237,7 +237,7 @@ class DownloadItem {
|
||||
ObserverList<Observer> observers_;
|
||||
|
||||
// Time the download was started
|
||||
Time start_time_;
|
||||
base::Time start_time_;
|
||||
|
||||
// Our persistent store handle
|
||||
int64 db_handle_;
|
||||
@ -329,12 +329,13 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
|
||||
// Remove downloads after remove_begin (inclusive) and before remove_end
|
||||
// (exclusive). You may pass in null Time values to do an unbounded delete
|
||||
// in either direction.
|
||||
int RemoveDownloadsBetween(const Time remove_begin, const Time remove_end);
|
||||
int RemoveDownloadsBetween(const base::Time remove_begin,
|
||||
const base::Time remove_end);
|
||||
|
||||
// Remove downloads will delete all downloads that have a timestamp that is
|
||||
// the same or more recent than |remove_begin|. The number of downloads
|
||||
// deleted is returned back to the caller.
|
||||
int RemoveDownloads(const Time remove_begin);
|
||||
int RemoveDownloads(const base::Time remove_begin);
|
||||
|
||||
// Download the object at the URL. Used in cases such as "Save Link As..."
|
||||
void DownloadUrl(const GURL& url,
|
||||
@ -418,8 +419,8 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
|
||||
// Update the history service for a particular download.
|
||||
void UpdateHistoryForDownload(DownloadItem* download);
|
||||
void RemoveDownloadFromHistory(DownloadItem* download);
|
||||
void RemoveDownloadsFromHistoryBetween(const Time remove_begin,
|
||||
const Time remove_before);
|
||||
void RemoveDownloadsFromHistoryBetween(const base::Time remove_begin,
|
||||
const base::Time remove_before);
|
||||
|
||||
// Inform the notification service of download starts and stops.
|
||||
void NotifyAboutDownloadStart();
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// Default name which will be used when we can not get proper name from
|
||||
// resource URL.
|
||||
static const wchar_t kDefaultSaveName[] = L"saved_resource";
|
||||
@ -1060,4 +1062,3 @@ bool SavePackage::GetSafePureFileName(const std::wstring& dir_path,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ class Profile;
|
||||
class WebContents;
|
||||
class URLRequestContext;
|
||||
class WebContents;
|
||||
class Time;
|
||||
|
||||
namespace base {
|
||||
class Thread;
|
||||
class Time;
|
||||
}
|
||||
|
||||
// The SavePackage object manages the process of saving a page as only-html or
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "chrome/common/sqlite_utils.h"
|
||||
#include "chrome/common/sqlite_compiled_statement.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// Download schema:
|
||||
//
|
||||
// id SQLite-generated primary key.
|
||||
@ -175,4 +177,3 @@ void DownloadDatabase::SearchDownloads(std::vector<int64>* results,
|
||||
}
|
||||
|
||||
} // namespace history
|
||||
|
||||
|
@ -40,7 +40,7 @@ class DownloadDatabase {
|
||||
// (inclusive) and before |remove_end|. You may use null Time values
|
||||
// to do an unbounded delete in either direction. This function ignores
|
||||
// all downloads that are in progress or are waiting to be cancelled.
|
||||
void RemoveDownloadsBetween(Time remove_begin, Time remove_end);
|
||||
void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
|
||||
|
||||
// Search for downloads matching the search text.
|
||||
void SearchDownloads(std::vector<int64>* results,
|
||||
|
@ -20,7 +20,7 @@
|
||||
struct DownloadCreateInfo {
|
||||
DownloadCreateInfo(const std::wstring& path,
|
||||
const std::wstring& url,
|
||||
Time start_time,
|
||||
base::Time start_time,
|
||||
int64 received_bytes,
|
||||
int64 total_bytes,
|
||||
int32 state,
|
||||
@ -50,7 +50,7 @@ struct DownloadCreateInfo {
|
||||
// A number that should be added to the suggested path to make it unique.
|
||||
// 0 means no number should be appended. Not actually stored in the db.
|
||||
int path_uniquifier;
|
||||
Time start_time;
|
||||
base::Time start_time;
|
||||
int64 received_bytes;
|
||||
int64 total_bytes;
|
||||
int32 state;
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "chrome/browser/history/thumbnail_database.h"
|
||||
#include "chrome/common/notification_types.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
namespace history {
|
||||
|
||||
namespace {
|
||||
|
@ -59,25 +59,25 @@ class ExpireHistoryBackend {
|
||||
|
||||
// Begins periodic expiration of history older than the given threshold. This
|
||||
// will continue until the object is deleted.
|
||||
void StartArchivingOldStuff(TimeDelta expiration_threshold);
|
||||
void StartArchivingOldStuff(base::TimeDelta expiration_threshold);
|
||||
|
||||
// Deletes everything associated with a URL.
|
||||
void DeleteURL(const GURL& url);
|
||||
|
||||
// Removes all visits in the given time range, updating the URLs accordingly.
|
||||
void ExpireHistoryBetween(Time begin_time, Time end_time);
|
||||
void ExpireHistoryBetween(base::Time begin_time, base::Time end_time);
|
||||
|
||||
// Archives all visits before and including the given time, updating the URLs
|
||||
// accordingly. This function is intended for migrating old databases
|
||||
// (which encompased all time) to the tiered structure and testing, and
|
||||
// probably isn't useful for anything else.
|
||||
void ArchiveHistoryBefore(Time end_time);
|
||||
void ArchiveHistoryBefore(base::Time end_time);
|
||||
|
||||
// Returns the current time that we are archiving stuff to. This will return
|
||||
// the threshold in absolute time rather than a delta, so the caller should
|
||||
// not save it.
|
||||
Time GetCurrentArchiveTime() const {
|
||||
return Time::Now() - expiration_threshold_;
|
||||
base::Time GetCurrentArchiveTime() const {
|
||||
return base::Time::Now() - expiration_threshold_;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -90,7 +90,7 @@ class ExpireHistoryBackend {
|
||||
struct DeleteDependencies {
|
||||
// The time range affected. These can be is_null() to be unbounded in one
|
||||
// or both directions.
|
||||
Time begin_time, end_time;
|
||||
base::Time begin_time, end_time;
|
||||
|
||||
// ----- Filled by DeleteVisitRelatedInfo or manually if a function doesn't
|
||||
// call that function. -----
|
||||
@ -208,7 +208,7 @@ class ExpireHistoryBackend {
|
||||
|
||||
// Schedules a call to DoArchiveIteration at the given time in the
|
||||
// future.
|
||||
void ScheduleArchive(TimeDelta delay);
|
||||
void ScheduleArchive(base::TimeDelta delay);
|
||||
|
||||
// Calls ArchiveSomeOldHistory to expire some amount of old history, and
|
||||
// schedules another call to happen in the future.
|
||||
@ -218,7 +218,7 @@ class ExpireHistoryBackend {
|
||||
// than |time_threshold|. The return value indicates if we think there might
|
||||
// be more history to expire with the current time threshold (it does not
|
||||
// indicate success or failure).
|
||||
bool ArchiveSomeOldHistory(Time time_threshold, int max_visits);
|
||||
bool ArchiveSomeOldHistory(base::Time time_threshold, int max_visits);
|
||||
|
||||
// Tries to detect possible bad history or inconsistencies in the database
|
||||
// and deletes items. For example, URLs with no visits.
|
||||
@ -243,7 +243,7 @@ class ExpireHistoryBackend {
|
||||
|
||||
// The threshold for "old" history where we will automatically expire it to
|
||||
// the archived database.
|
||||
TimeDelta expiration_threshold_;
|
||||
base::TimeDelta expiration_threshold_;
|
||||
|
||||
// The BookmarkService; may be null. This is owned by the Profile.
|
||||
//
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "SkBitmap.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
// The test must be in the history namespace for the gtest forward declarations
|
||||
// to work. It also eliminates a bunch of ugly "history::".
|
||||
namespace history {
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "chromium_strings.h"
|
||||
#include "generated_resources.h"
|
||||
|
||||
using base::Time;
|
||||
using history::HistoryBackend;
|
||||
|
||||
// Sends messages from the backend to us on the main thread. This must be a
|
||||
|
@ -163,7 +163,7 @@ class HistoryService : public CancelableRequestProvider,
|
||||
// For adding pages to history with a specific time. This is for testing
|
||||
// purposes. Call the previous one to use the current time.
|
||||
void AddPage(const GURL& url,
|
||||
Time time,
|
||||
base::Time time,
|
||||
const void* id_scope,
|
||||
int32 page_id,
|
||||
const GURL& referrer,
|
||||
@ -280,7 +280,7 @@ class HistoryService : public CancelableRequestProvider,
|
||||
typedef Callback4<Handle,
|
||||
bool, // Were we able to determine the # of visits?
|
||||
int, // Number of visits.
|
||||
Time>::Type // Time of first visit. Only first bool is
|
||||
base::Time>::Type // Time of first visit. Only first bool is
|
||||
// true and int is > 0.
|
||||
GetVisitCountToHostCallback;
|
||||
|
||||
@ -387,7 +387,7 @@ class HistoryService : public CancelableRequestProvider,
|
||||
// if they are no longer referenced. |callback| runs when the expiration is
|
||||
// complete. You may use null Time values to do an unbounded delete in
|
||||
// either direction.
|
||||
void ExpireHistoryBetween(Time begin_time, Time end_time,
|
||||
void ExpireHistoryBetween(base::Time begin_time, base::Time end_time,
|
||||
CancelableRequestConsumerBase* consumer,
|
||||
ExpireHistoryCallback* callback);
|
||||
|
||||
@ -434,7 +434,7 @@ class HistoryService : public CancelableRequestProvider,
|
||||
// progress or in the process of being cancelled. This is a 'fire and forget'
|
||||
// operation. You can pass is_null times to get unbounded time in either or
|
||||
// both directions.
|
||||
void RemoveDownloadsBetween(Time remove_begin, Time remove_end);
|
||||
void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
|
||||
|
||||
// Implemented by the caller of 'SearchDownloads' below, and is called when
|
||||
// the history system has retrieved the search results.
|
||||
@ -464,7 +464,7 @@ class HistoryService : public CancelableRequestProvider,
|
||||
// to the segment ID. The URL and all the other information is set to the page
|
||||
// representing the segment.
|
||||
Handle QuerySegmentUsageSince(CancelableRequestConsumerBase* consumer,
|
||||
const Time from_time,
|
||||
const base::Time from_time,
|
||||
SegmentQueryCallback* callback);
|
||||
|
||||
// Set the presentation index for the segment identified by |segment_id|.
|
||||
@ -533,7 +533,7 @@ class HistoryService : public CancelableRequestProvider,
|
||||
const std::wstring& title,
|
||||
int visit_count,
|
||||
int typed_count,
|
||||
Time last_visit,
|
||||
base::Time last_visit,
|
||||
bool hidden);
|
||||
|
||||
// The same as AddPageWithDetails() but takes a vector.
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "net/base/registry_controlled_domain.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
/* The HistoryBackend consists of a number of components:
|
||||
|
||||
HistoryDatabase (stores past 3 months of history)
|
||||
|
@ -197,16 +197,16 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
|
||||
void CreateDownload(scoped_refptr<DownloadCreateRequest> request,
|
||||
const DownloadCreateInfo& info);
|
||||
void RemoveDownload(int64 db_handle);
|
||||
void RemoveDownloadsBetween(const Time remove_begin,
|
||||
const Time remove_end);
|
||||
void RemoveDownloads(const Time remove_end);
|
||||
void RemoveDownloadsBetween(const base::Time remove_begin,
|
||||
const base::Time remove_end);
|
||||
void RemoveDownloads(const base::Time remove_end);
|
||||
void SearchDownloads(scoped_refptr<DownloadSearchRequest>,
|
||||
const std::wstring& search_text);
|
||||
|
||||
// Segment usage -------------------------------------------------------------
|
||||
|
||||
void QuerySegmentUsage(scoped_refptr<QuerySegmentUsageRequest> request,
|
||||
const Time from_time);
|
||||
const base::Time from_time);
|
||||
void DeleteOldSegmentData();
|
||||
void SetSegmentPresentationIndex(SegmentID segment_id, int index);
|
||||
|
||||
@ -234,8 +234,8 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
|
||||
|
||||
// Calls ExpireHistoryBackend::ExpireHistoryBetween and commits the change.
|
||||
void ExpireHistoryBetween(scoped_refptr<ExpireHistoryRequest> request,
|
||||
Time begin_time,
|
||||
Time end_time);
|
||||
base::Time begin_time,
|
||||
base::Time end_time);
|
||||
|
||||
// Bookmarks -----------------------------------------------------------------
|
||||
|
||||
@ -282,7 +282,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
|
||||
// This does not schedule database commits, it is intended to be used as a
|
||||
// subroutine for AddPage only. It also assumes the database is valid.
|
||||
std::pair<URLID, VisitID> AddPageVisit(const GURL& url,
|
||||
Time time,
|
||||
base::Time time,
|
||||
VisitID referring_visit,
|
||||
PageTransition::Type transition);
|
||||
|
||||
@ -345,7 +345,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
|
||||
VisitID from_visit,
|
||||
VisitID visit_id,
|
||||
PageTransition::Type transition_type,
|
||||
const Time ts);
|
||||
const base::Time ts);
|
||||
|
||||
// Favicons ------------------------------------------------------------------
|
||||
|
||||
@ -454,13 +454,13 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
|
||||
// of the timer), so we can try to ensure they're unique when they're added
|
||||
// to the database by using the last_recorded_time_ (q.v.). We still can't
|
||||
// enforce or guarantee uniqueness, since the user might set his clock back.
|
||||
Time last_requested_time_;
|
||||
base::Time last_requested_time_;
|
||||
|
||||
// Timestamp of the last page addition, as it was recorded in the database.
|
||||
// If two or more requests come in at the same time, we increment that time
|
||||
// by 1 us between them so it's more likely to be unique in the database.
|
||||
// This keeps track of that higher-resolution timestamp.
|
||||
Time last_recorded_time_;
|
||||
base::Time last_recorded_time_;
|
||||
|
||||
// When non-NULL, this is the task that should be invoked on
|
||||
MessageLoop* backend_destroy_message_loop_;
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "chrome/tools/profiles/thumbnail-inl.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// This file only tests functionality where it is most convenient to call the
|
||||
// backend directly. Most of the history backend functions are tested by the
|
||||
// history unit test. Because of the elaborate callbacks involved, this is no
|
||||
@ -385,4 +387,3 @@ TEST_F(HistoryBackendTest, GetPageThumbnailAfterRedirects) {
|
||||
}
|
||||
|
||||
} // namespace history
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace history {
|
||||
class HistoryAddPageArgs : public base::RefCounted<HistoryAddPageArgs> {
|
||||
public:
|
||||
HistoryAddPageArgs(const GURL& arg_url,
|
||||
Time arg_time,
|
||||
base::Time arg_time,
|
||||
const void* arg_id_scope,
|
||||
int32 arg_page_id,
|
||||
const GURL& arg_referrer,
|
||||
@ -37,7 +37,7 @@ class HistoryAddPageArgs : public base::RefCounted<HistoryAddPageArgs> {
|
||||
}
|
||||
|
||||
GURL url;
|
||||
Time time;
|
||||
base::Time time;
|
||||
|
||||
const void* id_scope;
|
||||
int32 page_id;
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include "chrome/browser/history/history.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
// Tests the history service for querying functionality.
|
||||
|
||||
namespace history {
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "chrome/browser/history/history_types.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace history {
|
||||
|
||||
// URLRow ----------------------------------------------------------------------
|
||||
|
@ -97,10 +97,10 @@ class URLRow {
|
||||
typed_count_ = typed_count;
|
||||
}
|
||||
|
||||
Time last_visit() const {
|
||||
base::Time last_visit() const {
|
||||
return last_visit_;
|
||||
}
|
||||
void set_last_visit(Time last_visit) {
|
||||
void set_last_visit(base::Time last_visit) {
|
||||
last_visit_ = last_visit;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ class URLRow {
|
||||
|
||||
// The date of the last visit of this URL, which saves us from having to
|
||||
// loop up in the visit table for things like autocomplete and expiration.
|
||||
Time last_visit_;
|
||||
base::Time last_visit_;
|
||||
|
||||
// Indicates this entry should now be shown in typical UI or queries, this
|
||||
// is usually for subframes.
|
||||
@ -173,7 +173,7 @@ class VisitRow {
|
||||
public:
|
||||
VisitRow();
|
||||
VisitRow(URLID arg_url_id,
|
||||
Time arg_visit_time,
|
||||
base::Time arg_visit_time,
|
||||
VisitID arg_referring_visit,
|
||||
PageTransition::Type arg_transition,
|
||||
SegmentID arg_segment_id);
|
||||
@ -184,7 +184,7 @@ class VisitRow {
|
||||
// Row ID into the URL table of the URL that this page is.
|
||||
URLID url_id;
|
||||
|
||||
Time visit_time;
|
||||
base::Time visit_time;
|
||||
|
||||
// Indicates another visit that was the referring page for this one.
|
||||
// 0 indicates no referrer.
|
||||
@ -236,7 +236,7 @@ struct ImportedFavIconUsage {
|
||||
// associated with a VisitRow.
|
||||
struct PageVisit {
|
||||
URLID page_id;
|
||||
Time visit_time;
|
||||
base::Time visit_time;
|
||||
};
|
||||
|
||||
// StarredEntry ---------------------------------------------------------------
|
||||
@ -278,7 +278,7 @@ struct StarredEntry {
|
||||
std::wstring title;
|
||||
|
||||
// When this was added.
|
||||
Time date_added;
|
||||
base::Time date_added;
|
||||
|
||||
// Group ID of the star group this entry is in. If 0, this entry is not
|
||||
// in a star group.
|
||||
@ -305,7 +305,7 @@ struct StarredEntry {
|
||||
|
||||
// Time the entry was last modified. This is only used for groups and
|
||||
// indicates the last time a URL was added as a child to the group.
|
||||
Time date_group_modified;
|
||||
base::Time date_group_modified;
|
||||
};
|
||||
|
||||
// URLResult -------------------------------------------------------------------
|
||||
@ -313,7 +313,7 @@ struct StarredEntry {
|
||||
class URLResult : public URLRow {
|
||||
public:
|
||||
URLResult() {}
|
||||
URLResult(const GURL& url, Time visit_time)
|
||||
URLResult(const GURL& url, base::Time visit_time)
|
||||
: URLRow(url),
|
||||
visit_time_(visit_time) {
|
||||
}
|
||||
@ -324,8 +324,8 @@ class URLResult : public URLRow {
|
||||
title_match_positions_ = title_matches;
|
||||
}
|
||||
|
||||
Time visit_time() const { return visit_time_; }
|
||||
void set_visit_time(Time visit_time) { visit_time_ = visit_time; }
|
||||
base::Time visit_time() const { return visit_time_; }
|
||||
void set_visit_time(base::Time visit_time) { visit_time_ = visit_time; }
|
||||
|
||||
const Snippet& snippet() const { return snippet_; }
|
||||
|
||||
@ -342,7 +342,7 @@ class URLResult : public URLRow {
|
||||
friend class HistoryBackend;
|
||||
|
||||
// The time that this result corresponds to.
|
||||
Time visit_time_;
|
||||
base::Time visit_time_;
|
||||
|
||||
// These values are typically set by HistoryBackend.
|
||||
Snippet snippet_;
|
||||
@ -373,8 +373,8 @@ class QueryResults {
|
||||
//
|
||||
// TODO(brettw): bug 1203054: This field is not currently set properly! Do
|
||||
// not use until the bug is fixed.
|
||||
Time first_time_searched() const { return first_time_searched_; }
|
||||
void set_first_time_searched(Time t) { first_time_searched_ = t; }
|
||||
base::Time first_time_searched() const { return first_time_searched_; }
|
||||
void set_first_time_searched(base::Time t) { first_time_searched_ = t; }
|
||||
// Note: If you need end_time_searched, it can be added.
|
||||
|
||||
size_t size() const { return results_.size(); }
|
||||
@ -429,7 +429,7 @@ class QueryResults {
|
||||
// (this is inclusive). This is used when inserting or deleting.
|
||||
void AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta);
|
||||
|
||||
Time first_time_searched_;
|
||||
base::Time first_time_searched_;
|
||||
|
||||
// The ordered list of results. The pointers inside this are owned by this
|
||||
// QueryResults object.
|
||||
@ -460,13 +460,13 @@ struct QueryOptions {
|
||||
// will be searched. However, if you set one, you must set the other.
|
||||
//
|
||||
// The beginning is inclusive and the ending is exclusive.
|
||||
Time begin_time;
|
||||
Time end_time;
|
||||
base::Time begin_time;
|
||||
base::Time end_time;
|
||||
|
||||
// Sets the query time to the last |days_ago| days to the present time.
|
||||
void SetRecentDayRange(int days_ago) {
|
||||
end_time = Time::Now();
|
||||
begin_time = end_time - TimeDelta::FromDays(days_ago);
|
||||
end_time = base::Time::Now();
|
||||
begin_time = end_time - base::TimeDelta::FromDays(days_ago);
|
||||
}
|
||||
|
||||
// When set, only one visit for each URL will be returned, which will be the
|
||||
@ -489,7 +489,7 @@ struct QueryOptions {
|
||||
// gives the time and search term of the keyword visit.
|
||||
struct KeywordSearchTermVisit {
|
||||
// The time of the visit.
|
||||
Time time;
|
||||
base::Time time;
|
||||
|
||||
// The search term that was used.
|
||||
std::wstring term;
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "chrome/browser/history/history_types.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace history {
|
||||
|
||||
namespace {
|
||||
|
@ -43,6 +43,9 @@
|
||||
#include "chrome/tools/profiles/thumbnail-inl.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
|
||||
class HistoryTest;
|
||||
|
||||
// Specialize RunnableMethodTraits for HistoryTest so we can create callbacks.
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "chrome/common/sqlite_utils.h"
|
||||
#include "chrome/common/stl_util-inl.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// The following table is used to store star (aka bookmark) information. This
|
||||
// class derives from URLDatabase, which has its own schema.
|
||||
//
|
||||
@ -626,4 +628,3 @@ bool StarredURLDatabase::MigrateBookmarksToFileImpl(const std::wstring& path) {
|
||||
}
|
||||
|
||||
} // namespace history
|
||||
|
||||
|
@ -73,7 +73,7 @@ class StarredURLDatabase : public URLDatabase {
|
||||
const std::wstring& title,
|
||||
UIStarID parent_group_id,
|
||||
int visual_order,
|
||||
Time date_modified);
|
||||
base::Time date_modified);
|
||||
|
||||
// Adjusts the visual order of all children of parent_group_id with a
|
||||
// visual_order >= start_visual_order by delta. For example,
|
||||
@ -91,7 +91,7 @@ class StarredURLDatabase : public URLDatabase {
|
||||
UIStarID group_id,
|
||||
UIStarID parent_group_id,
|
||||
const std::wstring& title,
|
||||
const Time& date_added,
|
||||
const base::Time& date_added,
|
||||
int visual_order,
|
||||
StarredEntry::Type type);
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
// an FTS table that is indexed like a normal table, and the index over it is
|
||||
// free since sqlite always indexes the internal rowid.
|
||||
|
||||
using base::Time;
|
||||
|
||||
namespace history {
|
||||
|
||||
namespace {
|
||||
|
@ -36,7 +36,7 @@ class TextDatabase {
|
||||
std::wstring title;
|
||||
|
||||
// Time the page that was returned was visited.
|
||||
Time time;
|
||||
base::Time time;
|
||||
|
||||
// Identifies any found matches in the title of the document. These are not
|
||||
// included in the snippet.
|
||||
@ -98,13 +98,13 @@ class TextDatabase {
|
||||
|
||||
// Adds the given data to the page. Returns true on success. The data should
|
||||
// already be converted to UTF-8.
|
||||
bool AddPageData(Time time,
|
||||
bool AddPageData(base::Time time,
|
||||
const std::string& url,
|
||||
const std::string& title,
|
||||
const std::string& contents);
|
||||
|
||||
// Deletes the indexed data exactly matching the given URL/time pair.
|
||||
void DeletePageData(Time time, const std::string& url);
|
||||
void DeletePageData(base::Time time, const std::string& url);
|
||||
|
||||
// Optimizes the tree inside the database. This will, in addition to making
|
||||
// access faster, remove any deleted data from the database (normally it is
|
||||
@ -133,7 +133,7 @@ class TextDatabase {
|
||||
const QueryOptions& options,
|
||||
std::vector<Match>* results,
|
||||
URLSet* unique_urls,
|
||||
Time* first_time_searched);
|
||||
base::Time* first_time_searched);
|
||||
|
||||
// Converts the given database identifier to a filename. This does not include
|
||||
// the path, just the file and extension.
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "base/string_util.h"
|
||||
#include "chrome/common/mru_cache.h"
|
||||
|
||||
using base::Time;
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
||||
namespace history {
|
||||
|
||||
namespace {
|
||||
|
@ -95,7 +95,7 @@ class TextDatabaseManager {
|
||||
// get updated to refer to the full text indexed information. The visit time
|
||||
// should be the time corresponding to that visit in the database.
|
||||
void AddPageURL(const GURL& url, URLID url_id, VisitID visit_id,
|
||||
Time visit_time);
|
||||
base::Time visit_time);
|
||||
void AddPageTitle(const GURL& url, const std::wstring& title);
|
||||
void AddPageContents(const GURL& url, const std::wstring& body);
|
||||
|
||||
@ -106,14 +106,14 @@ class TextDatabaseManager {
|
||||
bool AddPageData(const GURL& url,
|
||||
URLID url_id,
|
||||
VisitID visit_id,
|
||||
Time visit_time,
|
||||
base::Time visit_time,
|
||||
const std::wstring& title,
|
||||
const std::wstring& body);
|
||||
|
||||
// Deletes the instance of indexed data identified by the given time and URL.
|
||||
// Any changes will be tracked in the optional change set for use when calling
|
||||
// OptimizeChangedDatabases later. change_set can be NULL.
|
||||
void DeletePageData(Time time, const GURL& url,
|
||||
void DeletePageData(base::Time time, const GURL& url,
|
||||
ChangeSet* change_set);
|
||||
|
||||
// The text database manager keeps a list of changes that are made to the
|
||||
@ -124,7 +124,7 @@ class TextDatabaseManager {
|
||||
//
|
||||
// Either or both times my be is_null to be unbounded in that direction. When
|
||||
// non-null, the range is [begin, end).
|
||||
void DeleteFromUncommitted(Time begin, Time end);
|
||||
void DeleteFromUncommitted(base::Time begin, base::Time end);
|
||||
|
||||
// Same as DeleteFromUncommitted but for a single URL.
|
||||
void DeleteURLFromUncommitted(const GURL& url);
|
||||
@ -149,7 +149,7 @@ class TextDatabaseManager {
|
||||
void GetTextMatches(const std::wstring& query,
|
||||
const QueryOptions& options,
|
||||
std::vector<TextDatabase::Match>* results,
|
||||
Time* first_time_searched);
|
||||
base::Time* first_time_searched);
|
||||
|
||||
private:
|
||||
// These tests call ExpireRecentChangesForTime to force expiration.
|
||||
@ -161,12 +161,12 @@ class TextDatabaseManager {
|
||||
// visit, title, and body all come in at different times.
|
||||
class PageInfo {
|
||||
public:
|
||||
PageInfo(URLID url_id, VisitID visit_id, Time visit_time);
|
||||
PageInfo(URLID url_id, VisitID visit_id, base::Time visit_time);
|
||||
|
||||
// Getters.
|
||||
URLID url_id() const { return url_id_; }
|
||||
VisitID visit_id() const { return visit_id_; }
|
||||
Time visit_time() const { return visit_time_; }
|
||||
base::Time visit_time() const { return visit_time_; }
|
||||
const std::wstring& title() const { return title_; }
|
||||
const std::wstring& body() const { return body_; }
|
||||
|
||||
@ -183,7 +183,7 @@ class TextDatabaseManager {
|
||||
// Returns true if this entry was added too long ago and we should give up
|
||||
// waiting for more data. The current time is passed in as an argument so we
|
||||
// can check many without re-querying the timer.
|
||||
bool Expired(TimeTicks now) const;
|
||||
bool Expired(base::TimeTicks now) const;
|
||||
|
||||
private:
|
||||
URLID url_id_;
|
||||
@ -191,11 +191,11 @@ class TextDatabaseManager {
|
||||
|
||||
// Time of the visit of the URL. This will be the value stored in the URL
|
||||
// and visit tables for the entry.
|
||||
Time visit_time_;
|
||||
base::Time visit_time_;
|
||||
|
||||
// When this page entry was created. We have a cap on the maximum time that
|
||||
// an entry will be in the queue before being flushed to the database.
|
||||
TimeTicks added_time_;
|
||||
base::TimeTicks added_time_;
|
||||
|
||||
// Will be the string " " when they are set to distinguish set and unset.
|
||||
std::wstring title_;
|
||||
@ -203,8 +203,8 @@ class TextDatabaseManager {
|
||||
};
|
||||
|
||||
// Converts the given time to a database identifier or vice-versa.
|
||||
static TextDatabase::DBIdent TimeToID(Time time);
|
||||
static Time IDToTime(TextDatabase::DBIdent id);
|
||||
static TextDatabase::DBIdent TimeToID(base::Time time);
|
||||
static base::Time IDToTime(TextDatabase::DBIdent id);
|
||||
|
||||
// Returns a text database for the given identifier or time. This file will
|
||||
// be created if it doesn't exist and |for_writing| is set. On error,
|
||||
@ -217,7 +217,7 @@ class TextDatabaseManager {
|
||||
// The pointer will be tracked in the cache. The caller should not store it
|
||||
// or delete it since it will get automatically deleted as necessary.
|
||||
TextDatabase* GetDB(TextDatabase::DBIdent id, bool for_writing);
|
||||
TextDatabase* GetDBForTime(Time time, bool for_writing);
|
||||
TextDatabase* GetDBForTime(base::Time time, bool for_writing);
|
||||
|
||||
// Populates the present_databases_ list based on which files are on disk.
|
||||
// When the list is already initialized, this will do nothing, so you can
|
||||
@ -234,7 +234,7 @@ class TextDatabaseManager {
|
||||
// Given "now," this will expire old things from the recent_changes_ list.
|
||||
// This is used as the backend for FlushOldChanges and is called directly
|
||||
// by the unit tests with fake times.
|
||||
void FlushOldChangesForTime(TimeTicks now);
|
||||
void FlushOldChangesForTime(base::TimeTicks now);
|
||||
|
||||
// Directory holding our index files.
|
||||
const std::wstring dir_;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user