diff options
48 files changed, 151 insertions, 190 deletions
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc index dd20b39..e0ecd89 100644 --- a/base/message_loop_proxy_impl.cc +++ b/base/message_loop_proxy_impl.cc @@ -81,11 +81,11 @@ bool MessageLoopProxyImpl::PostTaskHelper( int64 delay_ms, bool nestable) { AutoLock lock(message_loop_lock_); if (target_message_loop_) { - base::TimeDelta delay = base::TimeDelta::FromMilliseconds(delay_ms); if (nestable) { - target_message_loop_->PostDelayedTask(from_here, task, delay); + target_message_loop_->PostDelayedTask(from_here, task, delay_ms); } else { - target_message_loop_->PostNonNestableDelayedTask(from_here, task, delay); + target_message_loop_->PostNonNestableDelayedTask(from_here, task, + delay_ms); } return true; } diff --git a/base/timer.cc b/base/timer.cc index 5c2aa21..9d175f3 100644 --- a/base/timer.cc +++ b/base/timer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,7 +25,7 @@ void BaseTimer_Helper::InitiateDelayedTask(TimerTask* timer_task) { MessageLoop::current()->PostDelayedTask( timer_task->posted_from_, base::Bind(&TimerTask::Run, base::Owned(timer_task)), - timer_task->delay_); + static_cast<int>(timer_task->delay_.InMillisecondsRoundedUp())); } } // namespace base diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index f0b92ca..065cc80 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -172,10 +172,8 @@ void FeedbackUtil::DispatchFeedback(Profile* profile, int64 delay) { DCHECK(post_body); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&FeedbackUtil::SendFeedback, profile, post_body, delay), - base::TimeDelta::FromMilliseconds(delay)); + MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind( + &FeedbackUtil::SendFeedback, profile, post_body, delay), delay); } // static diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc index dd2da73..2df3568 100644 --- a/chrome/browser/google/google_url_tracker.cc +++ b/chrome/browser/google/google_url_tracker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -188,11 +188,10 @@ void GoogleURLTracker::QueueWakeupTask() { // browser is starting up, and if so, come back later", but there is currently // no function to do this. static const int kStartFetchDelayMS = 5000; - MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&GoogleURLTracker::FinishSleep, weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kStartFetchDelayMS)); + kStartFetchDelayMS); } void GoogleURLTracker::FinishSleep() { diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index 3da7271..2a749dd 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -592,7 +592,7 @@ void ExpireHistoryBackend::ScheduleArchive() { FROM_HERE, base::Bind(&ExpireHistoryBackend::DoArchiveIteration, weak_factory_.GetWeakPtr()), - delay); + delay.InMilliseconds()); } void ExpireHistoryBackend::DoArchiveIteration() { @@ -687,7 +687,7 @@ void ExpireHistoryBackend::ScheduleExpireHistoryIndexFiles() { FROM_HERE, base::Bind(&ExpireHistoryBackend::DoExpireHistoryIndexFiles, weak_factory_.GetWeakPtr()), - delay); + delay.InMilliseconds()); } void ExpireHistoryBackend::DoExpireHistoryIndexFiles() { diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index d79fa6a..defc2f3 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -71,8 +71,9 @@ namespace history { // dependency between MostVisitedModel and the history backend. static const int kSegmentDataRetention = 90; -// How long we'll wait to do a commit, so that things are batched together. -static const int kCommitIntervalSeconds = 10; +// The number of milliseconds we'll wait to do a commit, so that things are +// batched together. +static const int kCommitIntervalMs = 10000; // The amount of time before we re-fetch the favicon. static const int kFaviconRefetchDays = 7; @@ -1941,7 +1942,7 @@ void HistoryBackend::ScheduleCommit() { MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), - base::TimeDelta::FromSeconds(kCommitIntervalSeconds)); + kCommitIntervalMs); } void HistoryBackend::CancelScheduledCommit() { diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index 964fee3..85126a1 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -214,7 +214,7 @@ TEST_F(RedirectTest, ClientServerServer) { NavigateToURL(first_url); for (int i = 0; i < 10; ++i) { - base::PlatformThread::Sleep(TestTimeouts::action_timeout()); + base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); @@ -322,7 +322,7 @@ TEST_F(RedirectTest, std::wstring final_url_title = UTF8ToWide("Title Of Awesomeness"); // Wait till the final page has been loaded. for (int i = 0; i < 10; ++i) { - base::PlatformThread::Sleep(TestTimeouts::action_timeout()); + base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title)); diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc index 499e3e1..98e5990 100644 --- a/chrome/browser/history/text_database_manager.cc +++ b/chrome/browser/history/text_database_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,7 +33,7 @@ std::string ConvertStringForIndexer(const string16& input) { // Data older than this will be committed to the full text index even if we // haven't gotten a title and/or body. -const int kExpirationSeconds = 20; +const int kExpirationSec = 20; } // namespace @@ -71,7 +71,7 @@ void TextDatabaseManager::PageInfo::set_body(const string16& bdy) { } bool TextDatabaseManager::PageInfo::Expired(TimeTicks now) const { - return now - added_time_ > base::TimeDelta::FromSeconds(kExpirationSeconds); + return now - added_time_ > TimeDelta::FromSeconds(kExpirationSec); } // TextDatabaseManager --------------------------------------------------------- @@ -208,8 +208,8 @@ void TextDatabaseManager::AddPageTitle(const GURL& url, // not worth it for this edge case. // // It will be almost impossible for the title to take longer than - // kExpirationSeconds yet we got a body in less than that time, since - // the title should always come in first. + // kExpirationSec yet we got a body in less than that time, since the + // title should always come in first. return; } @@ -235,9 +235,9 @@ void TextDatabaseManager::AddPageContents(const GURL& url, RecentChangeList::iterator found = recent_changes_.Peek(url); if (found == recent_changes_.end()) { // This page is not in our cache of recent pages. This means that the page - // took more than kExpirationSeconds to load. Often, this will be the result - // of a very slow iframe or other resource on the page that makes us think - // its still loading. + // took more than kExpirationSec to load. Often, this will be the result of + // a very slow iframe or other resource on the page that makes us think its + // still loading. // // As a fallback, set the most recent visit's contents using the input, and // use the last set title in the URL table as the title to index. @@ -538,7 +538,7 @@ void TextDatabaseManager::ScheduleFlushOldChanges() { FROM_HERE, base::Bind(&TextDatabaseManager::FlushOldChanges, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromSeconds(kExpirationSeconds)); + kExpirationSec * Time::kMillisecondsPerSecond); } void TextDatabaseManager::FlushOldChanges() { diff --git a/chrome/browser/images_uitest.cc b/chrome/browser/images_uitest.cc index bc146eb..5c36e40 100644 --- a/chrome/browser/images_uitest.cc +++ b/chrome/browser/images_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,7 @@ TEST_F(ImagesTest, AnimatedGIFs) { NavigateToURL(net::FilePathToFileURL(test_file)); // Let the GIFs fully animate. - base::PlatformThread::Sleep(TestTimeouts::action_timeout()); + base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); std::wstring page_title = L"animated gif test"; EXPECT_EQ(page_title, GetActiveTabTitle()); diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc index ab7d520..eb3265b 100644 --- a/chrome/browser/intranet_redirect_detector.cc +++ b/chrome/browser/intranet_redirect_detector.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,11 +33,11 @@ IntranetRedirectDetector::IntranetRedirectDetector() // Ideally, instead of this timer, we'd do something like "check if the // browser is starting up, and if so, come back later", but there is currently // no function to do this. - static const int kStartFetchDelaySeconds = 7; + static const int kStartFetchDelayMS = 7000; MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&IntranetRedirectDetector::FinishSleep, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromSeconds(kStartFetchDelaySeconds)); + kStartFetchDelayMS); net::NetworkChangeNotifier::AddIPAddressObserver(this); } @@ -154,7 +154,7 @@ void IntranetRedirectDetector::OnIPAddressChanged() { MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&IntranetRedirectDetector::FinishSleep, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kNetworkSwitchDelayMS)); + kNetworkSwitchDelayMS); } IntranetRedirectHostResolverProc::IntranetRedirectHostResolverProc( diff --git a/chrome/browser/media_uitest.cc b/chrome/browser/media_uitest.cc index 58e0433..91732ce 100644 --- a/chrome/browser/media_uitest.cc +++ b/chrome/browser/media_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,16 +31,15 @@ class MediaTest : public UITest { const std::wstring kPlaying = L"PLAYING"; const std::wstring kFailed = L"FAILED"; const std::wstring kError = L"ERROR"; - const base::TimeDelta kSleepInterval = - base::TimeDelta::FromMilliseconds(250); + const int kSleepIntervalMs = 250; const int kNumIntervals = - TestTimeouts::action_timeout() / kSleepInterval; + TestTimeouts::action_timeout_ms() / kSleepIntervalMs; for (int i = 0; i < kNumIntervals; ++i) { const std::wstring& title = GetActiveTabTitle(); if (title == kPlaying || title == kFailed || StartsWith(title, kError, true)) break; - base::PlatformThread::Sleep(kSleepInterval); + base::PlatformThread::Sleep(kSleepIntervalMs); } EXPECT_EQ(kPlaying, GetActiveTabTitle()); diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 2c9b4c6..cfaf6ef 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -100,7 +100,7 @@ HintInfoBar::HintInfoBar(OmniboxSearchHint* omnibox_hint) MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&HintInfoBar::AllowExpiry, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromSeconds(8)); + 8000); // 8 seconds. } HintInfoBar::~HintInfoBar() { diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index ca9f9a3..eda06a0 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -835,7 +835,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( return PROCESS_NONE; } - base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); + base::PlatformThread::Sleep(1000 /* ms */); } timeval timeout = {timeout_seconds, 0}; diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index 5999a27..02bf510 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,7 +26,7 @@ using base::Time; using base::TimeDelta; using WebKit::WebCache; -static const int kReviseAllocationDelayMS = 200; +static const unsigned int kReviseAllocationDelayMS = 200 /* milliseconds */; // The default size limit of the in-memory cache is 8 MB static const int kDefaultMemoryCacheSize = 8 * 1024 * 1024; @@ -421,7 +421,7 @@ void WebCacheManager::ReviseAllocationStrategyLater() { base::Bind( &WebCacheManager::ReviseAllocationStrategy, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kReviseAllocationDelayMS)); + kReviseAllocationDelayMS); } void WebCacheManager::FindInactiveRenderers() { diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc index 85c410e..0af1ab4 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -245,7 +245,7 @@ void ClientSideDetectionService::ScheduleFetchModel(int64 delay_ms) { FROM_HERE, base::Bind(&ClientSideDetectionService::StartFetchModel, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(delay_ms)); + delay_ms); } void ClientSideDetectionService::StartFetchModel() { diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 9c8c652..907a424 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -1239,7 +1239,7 @@ void SafeBrowsingService::StartDownloadCheck(SafeBrowsingCheck* check, MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&SafeBrowsingService::TimeoutCallback, check->timeout_factory_->GetWeakPtr(), check), - base::TimeDelta::FromMilliseconds(timeout_ms)); + timeout_ms); } void SafeBrowsingService::UpdateWhitelist(const UnsafeResource& resource) { diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 94a3a89..2d974f6 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -300,7 +300,7 @@ void ServiceProcessControl::Launcher::DoDetectLaunched() { retry_count_++; // If the service process is not launched yet then check again in 2 seconds. - const base::TimeDelta kDetectLaunchRetry = base::TimeDelta::FromSeconds(2); + const int kDetectLaunchRetry = 2000; MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&Launcher::DoDetectLaunched, this), kDetectLaunchRetry); diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index c141ed0..9015f14 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -627,9 +627,8 @@ void TaskManagerModel::StartUpdating() { // it to TASK_PENDING ensures the tasks keep being posted (by Refresh()). if (update_state_ == IDLE) { MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&TaskManagerModel::Refresh, this), - base::TimeDelta::FromMilliseconds(kUpdateTimeMs)); + FROM_HERE, base::Bind(&TaskManagerModel::Refresh, this), + kUpdateTimeMs); } update_state_ = TASK_PENDING; @@ -871,16 +870,14 @@ void TaskManagerModel::Refresh() { // Compute the new network usage values. displayed_network_usage_map_.clear(); - base::TimeDelta update_time = - base::TimeDelta::FromMilliseconds(kUpdateTimeMs); for (ResourceValueMap::iterator iter = current_byte_count_map_.begin(); iter != current_byte_count_map_.end(); ++iter) { - if (update_time > base::TimeDelta::FromSeconds(1)) { - int divider = update_time.InSeconds(); + if (kUpdateTimeMs > 1000) { + int divider = (kUpdateTimeMs / 1000); displayed_network_usage_map_[iter->first] = iter->second / divider; } else { displayed_network_usage_map_[iter->first] = iter->second * - (1 / update_time.InSeconds()); + (1000 / kUpdateTimeMs); } // Then we reset the current byte count. @@ -900,9 +897,7 @@ void TaskManagerModel::Refresh() { // Schedule the next update. MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&TaskManagerModel::Refresh, this), - base::TimeDelta::FromMilliseconds(kUpdateTimeMs)); + FROM_HERE, base::Bind(&TaskManagerModel::Refresh, this), kUpdateTimeMs); } int64 TaskManagerModel::GetNetworkUsageForResource( diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 94db9d2..8fd0c4f 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -138,7 +138,7 @@ const char* const kReportLanguageDetectionErrorURL = const char* const kLanguageListFetchURL = "http://translate.googleapis.com/translate_a/l?client=chrome&cb=sl"; const int kMaxRetryLanguageListFetch = 5; -const int kTranslateScriptExpirationDelayDays = 1; +const int kTranslateScriptExpirationDelayMS = 24 * 60 * 60 * 1000; // 1 day. } // namespace @@ -450,8 +450,7 @@ bool TranslateManager::IsShowingTranslateInfobar(WebContents* tab) { TranslateManager::TranslateManager() : ALLOW_THIS_IN_INITIALIZER_LIST(weak_method_factory_(this)), - translate_script_expiration_delay_( - base::TimeDelta::FromDays(kTranslateScriptExpirationDelayDays)) { + translate_script_expiration_delay_(kTranslateScriptExpirationDelayMS) { notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); notification_registrar_.Add(this, diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h index 9409732..5e7f089 100644 --- a/chrome/browser/translate/translate_manager.h +++ b/chrome/browser/translate/translate_manager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -83,8 +83,7 @@ class TranslateManager : public content::NotificationObserver, // Used by unit-tests to override the default delay after which the translate // script is fetched again from the translation server. void set_translate_script_expiration_delay(int delay_ms) { - translate_script_expiration_delay_ = - base::TimeDelta::FromMilliseconds(delay_ms); + translate_script_expiration_delay_ = delay_ms; } // Convenience method to know if a tab is showing a translate infobar. @@ -199,9 +198,9 @@ class TranslateManager : public content::NotificationObserver, // The JS injected in the page to do the translation. std::string translate_script_; - // Delay after which the translate script is fetched again + // Delay in milli-seconds after which the translate script is fetched again // from the translate server. - base::TimeDelta translate_script_expiration_delay_; + int translate_script_expiration_delay_; // Set when the translate JS is currently being retrieved. NULL otherwise. scoped_ptr<content::URLFetcher> translate_script_request_pending_; diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc index 7058e27..3ef1290 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,8 +16,6 @@ #include "ui/base/events.h" #include "ui/base/ui_base_types.h" -using base::TimeDelta; - const std::string NOLISTENERS_HTML = "<html><head><title>nolisteners</title></head><body></body></html>"; @@ -107,12 +105,12 @@ class UnloadTest : public UITest { } void CheckTitle(const std::wstring& expected_title) { - const TimeDelta kCheckDelay = TimeDelta::FromMilliseconds(100); - for (TimeDelta max_wait_time = TestTimeouts::action_max_timeout(); - max_wait_time > TimeDelta(); max_wait_time -= kCheckDelay) { + const int kCheckDelayMs = 100; + for (int max_wait_time = TestTimeouts::action_max_timeout_ms(); + max_wait_time > 0; max_wait_time -= kCheckDelayMs) { if (expected_title == GetActiveTabTitle()) break; - base::PlatformThread::Sleep(kCheckDelay); + base::PlatformThread::Sleep(kCheckDelayMs); } EXPECT_EQ(expected_title, GetActiveTabTitle()); @@ -306,7 +304,7 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) { // There's no real graceful way to wait for something _not_ to happen, so // we just wait a short period. - base::PlatformThread::Sleep(TestTimeouts::action_timeout()); + base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); CloseBrowserAsync(browser.get()); ClickModalDialogButton(ui::DIALOG_BUTTON_OK); diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc index e148691..2d52cb0 100644 --- a/chrome/browser/visitedlink/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink/visitedlink_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -590,10 +590,8 @@ class VisitedLinkEventsTest : public ChromeRenderViewHostTestHarness { void WaitForCoalescense() { // Let the timer fire. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - MessageLoop::QuitClosure(), - base::TimeDelta::FromMilliseconds(110)); + MessageLoop::current()->PostDelayedTask(FROM_HERE, + MessageLoop::QuitClosure(), 110); MessageLoop::current()->Run(); } diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc index 8d12fb5..3ca0e80 100644 --- a/chrome/browser/web_resource/promo_resource_service.cc +++ b/chrome/browser/web_resource/promo_resource_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -217,7 +217,7 @@ void PromoResourceService::PostNotification(int64 delay_ms) { FROM_HERE, base::Bind(&PromoResourceService::PromoResourceStateChange, weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(delay_ms)); + delay_ms); } else if (delay_ms == 0) { PromoResourceStateChange(); } diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index 8fc7ae7..65a6de5 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -180,7 +180,7 @@ void WebResourceService::ScheduleFetch(int64 delay_ms) { FROM_HERE, base::Bind(&WebResourceService::StartFetch, weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(delay_ms)); + delay_ms); } // Initializes the fetching of data from the resource server. Data diff --git a/chrome/common/important_file_writer_unittest.cc b/chrome/common/important_file_writer_unittest.cc index f44ce60..84d307a 100644 --- a/chrome/common/important_file_writer_unittest.cc +++ b/chrome/common/important_file_writer_unittest.cc @@ -75,10 +75,8 @@ TEST_F(ImportantFileWriterTest, ScheduleWrite) { DataSerializer serializer("foo"); writer.ScheduleWrite(&serializer); EXPECT_TRUE(writer.HasPendingWrite()); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - MessageLoop::QuitClosure(), - base::TimeDelta::FromMilliseconds(100)); + MessageLoop::current()->PostDelayedTask(FROM_HERE, + MessageLoop::QuitClosure(), 100); MessageLoop::current()->Run(); EXPECT_FALSE(writer.HasPendingWrite()); ASSERT_TRUE(file_util::PathExists(writer.path())); @@ -93,10 +91,8 @@ TEST_F(ImportantFileWriterTest, DoScheduledWrite) { writer.ScheduleWrite(&serializer); EXPECT_TRUE(writer.HasPendingWrite()); writer.DoScheduledWrite(); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - MessageLoop::QuitClosure(), - base::TimeDelta::FromMilliseconds(100)); + MessageLoop::current()->PostDelayedTask(FROM_HERE, + MessageLoop::QuitClosure(), 100); MessageLoop::current()->Run(); EXPECT_FALSE(writer.HasPendingWrite()); ASSERT_TRUE(file_util::PathExists(writer.path())); @@ -112,10 +108,8 @@ TEST_F(ImportantFileWriterTest, FLAKY_BatchingWrites) { writer.ScheduleWrite(&foo); writer.ScheduleWrite(&bar); writer.ScheduleWrite(&baz); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - MessageLoop::QuitClosure(), - base::TimeDelta::FromMilliseconds(100)); + MessageLoop::current()->PostDelayedTask(FROM_HERE, + MessageLoop::QuitClosure(), 100); MessageLoop::current()->Run(); ASSERT_TRUE(file_util::PathExists(writer.path())); EXPECT_EQ("baz", GetFileContent(writer.path())); diff --git a/chrome/common/profiling.cc b/chrome/common/profiling.cc index e9d33f5..f355052 100644 --- a/chrome/common/profiling.cc +++ b/chrome/common/profiling.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,7 +41,7 @@ void FlushProfilingData(base::Thread* thread) { return; base::debug::FlushProfiling(); - static int flush_seconds; + static int flush_seconds = 0; if (!flush_seconds) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); std::string profiling_flush = @@ -54,9 +54,7 @@ void FlushProfilingData(base::Thread* thread) { } } thread->message_loop()->PostDelayedTask( - FROM_HERE, - base::Bind(&FlushProfilingData, thread), - base::TimeDelta::FromSeconds(flush_seconds)); + FROM_HERE, base::Bind(&FlushProfilingData, thread), flush_seconds * 1000); } class ProfilingThreadControl { diff --git a/chrome/common/service_process_util_linux.cc b/chrome/common/service_process_util_linux.cc index 5fb5a81..457a50c 100644 --- a/chrome/common/service_process_util_linux.cc +++ b/chrome/common/service_process_util_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,7 +31,7 @@ MultiProcessLock* TakeNamedLock(const std::string& name, bool waiting) { break; } if (!waiting) break; - base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100 * i)); + base::PlatformThread::Sleep(100 * i); } if (!got_lock) { lock.reset(); diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index c8f5677..5de195d 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -185,7 +185,7 @@ TEST_F(ServiceProcessStateTest, MAYBE_ForceShutdown) { true); ASSERT_TRUE(handle); for (int i = 0; !CheckServiceProcessReady() && i < 10; ++i) { - base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); + base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); } ASSERT_TRUE(CheckServiceProcessReady()); std::string version; @@ -228,7 +228,7 @@ MULTIPROCESS_TEST_MAIN(ServiceProcessStateTestShutdown) { MessageLoop::current()))); message_loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), - TestTimeouts::action_max_timeout()); + TestTimeouts::action_max_timeout_ms()); EXPECT_FALSE(g_good_shutdown); message_loop.Run(); EXPECT_TRUE(g_good_shutdown); @@ -274,7 +274,7 @@ class ServiceProcessStateFileManipulationTest : public ::testing::Test { base::Closure())); loop_.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), - TestTimeouts::action_max_timeout()); + TestTimeouts::action_max_timeout_ms()); } const MockLaunchd* mock_launchd() const { return mock_launchd_.get(); } diff --git a/chrome/common/worker_thread_ticker.cc b/chrome/common/worker_thread_ticker.cc index b1dc279..391f0a3 100644 --- a/chrome/common/worker_thread_ticker.cc +++ b/chrome/common/worker_thread_ticker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,7 @@ WorkerThreadTicker::WorkerThreadTicker(int tick_interval) : timer_thread_("worker_thread_ticker"), is_running_(false), - tick_interval_(base::TimeDelta::FromMilliseconds(tick_interval)) { + tick_interval_(tick_interval) { } WorkerThreadTicker::~WorkerThreadTicker() { diff --git a/chrome/common/worker_thread_ticker.h b/chrome/common/worker_thread_ticker.h index d009a62..dc5f542 100644 --- a/chrome/common/worker_thread_ticker.h +++ b/chrome/common/worker_thread_ticker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -58,11 +58,11 @@ class WorkerThreadTicker { } void set_tick_interval(int tick_interval) { - tick_interval_ = base::TimeDelta::FromMilliseconds(tick_interval); + tick_interval_ = tick_interval; } int tick_interval() const { - return tick_interval_.InMilliseconds(); + return tick_interval_; } private: @@ -80,7 +80,7 @@ class WorkerThreadTicker { bool is_running_; // The interval at which the callbacks are to be invoked - base::TimeDelta tick_interval_; + int tick_interval_; // A list that holds all registered callback interfaces TickHandlerListType tick_handler_list_; diff --git a/chrome/common/worker_thread_ticker_unittest.cc b/chrome/common/worker_thread_ticker_unittest.cc index ffb0d00..b999c33 100644 --- a/chrome/common/worker_thread_ticker_unittest.cc +++ b/chrome/common/worker_thread_ticker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,15 +32,13 @@ class TestCallback : public WorkerThreadTicker::Callback { class LongCallback : public WorkerThreadTicker::Callback { public: virtual void OnTick() { - base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1500)); + base::PlatformThread::Sleep(1500); } }; void RunMessageLoopForAWhile() { - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - MessageLoop::QuitClosure(), - base::TimeDelta::FromMilliseconds(500)); + MessageLoop::current()->PostDelayedTask(FROM_HERE, + MessageLoop::QuitClosure(), 500); MessageLoop::current()->Run(); } diff --git a/chrome/renderer/about_handler.cc b/chrome/renderer/about_handler.cc index 8651b6e..1b21e76 100644 --- a/chrome/renderer/about_handler.cc +++ b/chrome/renderer/about_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -61,13 +61,13 @@ void AboutHandler::AboutKill() { // static void AboutHandler::AboutHang() { for (;;) { - base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); + base::PlatformThread::Sleep(1000); } } // static void AboutHandler::AboutShortHang() { - base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); + base::PlatformThread::Sleep(20000); } // static diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index ed58e72..7df7197 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -56,7 +56,7 @@ using content::RenderThread; namespace { -static const int kCacheStatsDelayMS = 2000; +static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */; class RendererResourceDelegate : public content::ResourceDispatcherDelegate { public: @@ -75,7 +75,7 @@ class RendererResourceDelegate : public content::ResourceDispatcherDelegate { FROM_HERE, base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); + kCacheStatsDelayMS); } if (status.status() != net::URLRequestStatus::CANCELED || diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 403cdc8..55b3dda 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -665,9 +665,7 @@ void ChromeRenderViewObserver::DidStopLoading() { FROM_HERE, base::Bind(&ChromeRenderViewObserver::CapturePageInfo, weak_factory_.GetWeakPtr(), render_view()->GetPageId(), false), - base::TimeDelta::FromMilliseconds( - render_view()->GetContentStateImmediately() ? - 0 : kDelayForCaptureMs)); + render_view()->GetContentStateImmediately() ? 0 : kDelayForCaptureMs); WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); GURL osd_url = main_frame->document().openSearchDescriptionURL(); @@ -723,7 +721,7 @@ void ChromeRenderViewObserver::DidCommitProvisionalLoad( FROM_HERE, base::Bind(&ChromeRenderViewObserver::CapturePageInfo, weak_factory_.GetWeakPtr(), render_view()->GetPageId(), true), - base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs)); + kDelayForForcedCaptureMs); } void ChromeRenderViewObserver::DidClearWindowObject(WebFrame* frame) { diff --git a/chrome/renderer/extensions/user_script_idle_scheduler.cc b/chrome/renderer/extensions/user_script_idle_scheduler.cc index 13853d6..4042bfd 100644 --- a/chrome/renderer/extensions/user_script_idle_scheduler.cc +++ b/chrome/renderer/extensions/user_script_idle_scheduler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -56,7 +56,7 @@ void UserScriptIdleScheduler::DidFinishDocumentLoad() { MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kUserScriptIdleTimeoutMs)); + kUserScriptIdleTimeoutMs); } void UserScriptIdleScheduler::DidFinishLoad() { diff --git a/chrome/renderer/net/renderer_net_predictor.cc b/chrome/renderer/net/renderer_net_predictor.cc index 746cd22..9b6c489 100644 --- a/chrome/renderer/net/renderer_net_predictor.cc +++ b/chrome/renderer/net/renderer_net_predictor.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -57,7 +57,7 @@ void RendererNetPredictor::Resolve(const char* name, size_t length) { RenderThread::Get()->GetMessageLoop()->PostDelayedTask( FROM_HERE, base::Bind(&RendererNetPredictor::SubmitHostnames, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(10)); + 10); } return; } @@ -92,7 +92,7 @@ void RendererNetPredictor::SubmitHostnames() { RenderThread::Get()->GetMessageLoop()->PostDelayedTask( FROM_HERE, base::Bind(&RendererNetPredictor::SubmitHostnames, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(10)); + 10); } else { // TODO(JAR): Should we only clear the map when we navigate, or reload? domain_map_.clear(); diff --git a/chrome/renderer/translate_helper.cc b/chrome/renderer/translate_helper.cc index 124fffb..36e1e4c 100644 --- a/chrome/renderer/translate_helper.cc +++ b/chrome/renderer/translate_helper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,7 +28,7 @@ using WebKit::WebScriptSource; using WebKit::WebString; using WebKit::WebView; -// The delay in milliseconds that we'll wait before checking to see if the +// The delay in millliseconds that we'll wait before checking to see if the // translate library injected in the page is ready. static const int kTranslateInitCheckDelayMs = 150; @@ -339,12 +339,10 @@ void TranslateHelper::CheckTranslateStatus() { } // The translation is still pending, check again later. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, + MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&TranslateHelper::CheckTranslateStatus, weak_method_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds( - DontDelayTasks() ? 0 : kTranslateStatusCheckDelayMs)); + DontDelayTasks() ? 0 : kTranslateStatusCheckDelayMs); } bool TranslateHelper::ExecuteScript(const std::string& script) { @@ -403,12 +401,10 @@ void TranslateHelper::TranslatePageImpl(int count) { NotifyBrowserTranslationFailed(TranslateErrors::INITIALIZATION_ERROR); return; } - MessageLoop::current()->PostDelayedTask( - FROM_HERE, + MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&TranslateHelper::TranslatePageImpl, weak_method_factory_.GetWeakPtr(), count), - base::TimeDelta::FromMilliseconds( - DontDelayTasks() ? 0 : count * kTranslateInitCheckDelayMs)); + DontDelayTasks() ? 0 : count * kTranslateInitCheckDelayMs); return; } @@ -417,12 +413,10 @@ void TranslateHelper::TranslatePageImpl(int count) { return; } // Check the status of the translation. - MessageLoop::current()->PostDelayedTask( - FROM_HERE, + MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&TranslateHelper::CheckTranslateStatus, weak_method_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds( - DontDelayTasks() ? 0 : kTranslateStatusCheckDelayMs)); + DontDelayTasks() ? 0 : kTranslateStatusCheckDelayMs); } void TranslateHelper::NotifyBrowserTranslationFailed( diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc index a94ccd5..38861aa 100644 --- a/content/browser/browser_child_process_host.cc +++ b/content/browser/browser_child_process_host.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -207,13 +207,12 @@ void BrowserChildProcessHost::OnChildDisconnected() { // disconnecting the channel so that the exit code and termination status // become available. This is best effort -- if the process doesn't die // within the time limit, this object gets destroyed. - const base::TimeDelta kExitCodeWait = - base::TimeDelta::FromMilliseconds(250); + const int kExitCodeWaitMs = 250; MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&BrowserChildProcessHost::OnChildDisconnected, task_factory_.GetWeakPtr()), - kExitCodeWait); + kExitCodeWaitMs); #endif return; } diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index 294c622..f7cca04 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc @@ -134,11 +134,10 @@ bool BrowserThreadImpl::PostTaskHelper( MessageLoop* message_loop = g_browser_threads[identifier] ? g_browser_threads[identifier]->message_loop() : NULL; if (message_loop) { - base::TimeDelta delay = base::TimeDelta::FromMilliseconds(delay_ms); if (nestable) { - message_loop->PostDelayedTask(from_here, task, delay); + message_loop->PostDelayedTask(from_here, task, delay_ms); } else { - message_loop->PostNonNestableDelayedTask(from_here, task, delay); + message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); } } diff --git a/content/browser/gamepad/gamepad_provider.cc b/content/browser/gamepad/gamepad_provider.cc index 3c533c3..4c00cc1 100644 --- a/content/browser/gamepad/gamepad_provider.cc +++ b/content/browser/gamepad/gamepad_provider.cc @@ -140,7 +140,7 @@ void GamepadProvider::ScheduleDoPoll() { MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&GamepadProvider::DoPoll, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kDesiredSamplingIntervalMs)); + kDesiredSamplingIntervalMs); } GamepadHardwareBuffer* GamepadProvider::SharedMemoryAsHardwareBuffer() { diff --git a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc index 8fbb16d..b46ae9f 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -287,7 +287,7 @@ TEST_F(ResourceDispatcherTest, FAILS_CrossSiteAfterCrash) { #endif ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL))); // Wait for browser to notice the renderer crash. - base::PlatformThread::Sleep(TestTimeouts::action_timeout()); + base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); // Navigate to a new cross-site page. The browser should not wait around for // the old renderer's on{before}unload handlers to run. diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc index 56bdf47..a410af7 100644 --- a/content/plugin/plugin_channel.cc +++ b/content/plugin/plugin_channel.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,7 +31,7 @@ void PluginReleaseCallback() { } // How long we wait before releasing the plugin process. -const int kPluginReleaseTimeMinutes = 5; +const int kPluginReleaseTimeMs = 5 * 60 * 1000; // 5 minutes } // namespace @@ -177,9 +177,7 @@ PluginChannel::~PluginChannel() { base::CloseProcessHandle(renderer_handle_); MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&PluginReleaseCallback), - base::TimeDelta::FromMinutes(kPluginReleaseTimeMinutes)); + FROM_HERE, base::Bind(&PluginReleaseCallback), kPluginReleaseTimeMs); } bool PluginChannel::Send(IPC::Message* msg) { diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc index 77dc9d1..60bb5ad 100644 --- a/content/plugin/plugin_thread.cc +++ b/content/plugin/plugin_thread.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -49,15 +49,14 @@ class EnsureTerminateMessageFilter : public IPC::ChannelProxy::MessageFilter { private: virtual void OnChannelError() { // How long we wait before forcibly shutting down the process. - const base::TimeDelta kPluginProcessTerminateTimeout = - base::TimeDelta::FromSeconds(3); + const int kPluginProcessTerminateTimeoutMs = 3000; // Ensure that we don't wait indefinitely for the plugin to shutdown. // as the browser does not terminate plugin processes on shutdown. // We achieve this by posting an exit process task on the IO thread. MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&EnsureTerminateMessageFilter::Terminate, this), - kPluginProcessTerminateTimeout); + kPluginProcessTerminateTimeoutMs); } void Terminate() { diff --git a/content/ppapi_plugin/broker_process_dispatcher.cc b/content/ppapi_plugin/broker_process_dispatcher.cc index 7cdc0e34..6fce803 100644 --- a/content/ppapi_plugin/broker_process_dispatcher.cc +++ b/content/ppapi_plugin/broker_process_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ namespace { // How long we wait before releasing the broker process. -const int kBrokerReleaseTimeSeconds = 30; +const int kBrokerReleaseTimeMs = 30 * 1000; // 30 seconds. } // namespace @@ -34,5 +34,5 @@ BrokerProcessDispatcher::~BrokerProcessDispatcher() { FROM_HERE, base::Bind(&ChildProcess::ReleaseProcess, base::Unretained(ChildProcess::current())), - base::TimeDelta::FromSeconds(kBrokerReleaseTimeSeconds)); + kBrokerReleaseTimeMs); } diff --git a/content/ppapi_plugin/plugin_process_dispatcher.cc b/content/ppapi_plugin/plugin_process_dispatcher.cc index 5d33e12..1ac23d1 100644 --- a/content/ppapi_plugin/plugin_process_dispatcher.cc +++ b/content/ppapi_plugin/plugin_process_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ namespace { // How long we wait before releasing the plugin process. -const int kPluginReleaseTimeSeconds = 30; +const int kPluginReleaseTimeMs = 30 * 1000; // 30 seconds. } // namespace @@ -32,5 +32,5 @@ PluginProcessDispatcher::~PluginProcessDispatcher() { FROM_HERE, base::Bind(&ChildProcess::ReleaseProcess, base::Unretained(ChildProcess::current())), - base::TimeDelta::FromSeconds(kPluginReleaseTimeSeconds)); + kPluginReleaseTimeMs); } diff --git a/content/renderer/load_progress_tracker.cc b/content/renderer/load_progress_tracker.cc index b7a14ba..cc153f6 100644 --- a/content/renderer/load_progress_tracker.cc +++ b/content/renderer/load_progress_tracker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -51,11 +51,9 @@ void LoadProgressTracker::DidChangeLoadProgress(WebKit::WebFrame* frame, // last updates. Also, since the message loop may be pretty busy when a page // is loaded, it might not execute a posted task in a timely manner so we make // sure to immediately send progress report if enough time has passed. - base::TimeDelta min_delay = - base::TimeDelta::FromMilliseconds(kMinimumDelayBetweenUpdatesMS); if (progress == 1.0 || last_time_progress_sent_.is_null() || - base::TimeTicks::Now() - last_time_progress_sent_ > - min_delay) { + (base::TimeTicks::Now() - last_time_progress_sent_).InMilliseconds() > + kMinimumDelayBetweenUpdatesMS) { // If there is a pending task to send progress, it is now obsolete. weak_factory_.InvalidateWeakPtrs(); SendChangeLoadProgress(); @@ -71,7 +69,7 @@ void LoadProgressTracker::DidChangeLoadProgress(WebKit::WebFrame* frame, FROM_HERE, base::Bind(&LoadProgressTracker::SendChangeLoadProgress, weak_factory_.GetWeakPtr()), - min_delay); + kMinimumDelayBetweenUpdatesMS); } void LoadProgressTracker::SendChangeLoadProgress() { diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 8f610a5..6840d8b 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -677,13 +677,13 @@ void RenderWidget::AnimateIfNeeded() { return; // Target 60FPS if vsync is on. Go as fast as we can if vsync is off. - base::TimeDelta animationInterval = IsRenderingVSynced() ? - base::TimeDelta::FromMilliseconds(16) : base::TimeDelta(); + int animationInterval = IsRenderingVSynced() ? 16 : 0; base::Time now = base::Time::Now(); if (now >= animation_floor_time_ || is_accelerated_compositing_active_) { TRACE_EVENT0("renderer", "RenderWidget::AnimateIfNeeded") - animation_floor_time_ = now + animationInterval; + animation_floor_time_ = now + + base::TimeDelta::FromMilliseconds(animationInterval); // Set a timer to call us back after animationInterval before // running animation callbacks so that if a callback requests another // we'll be sure to run it at the proper time. @@ -706,7 +706,7 @@ void RenderWidget::AnimateIfNeeded() { // base::Time::Now() has advanced past the animation_floor_time_. To // avoid exposing this delay to javascript, we keep posting delayed // tasks until base::Time::Now() has advanced far enough. - base::TimeDelta delay = animation_floor_time_ - now; + int64 delay = (animation_floor_time_ - now).InMillisecondsRoundedUp(); animation_task_posted_ = true; MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&RenderWidget::AnimationCallback, this), delay); diff --git a/dbus/test_service.cc b/dbus/test_service.cc index 714c09b..ea8e360 100644 --- a/dbus/test_service.cc +++ b/dbus/test_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -190,7 +190,7 @@ void TestService::Echo(MethodCall* method_call, void TestService::SlowEcho( MethodCall* method_call, dbus::ExportedObject::ResponseSender response_sender) { - base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); + base::PlatformThread::Sleep(TestTimeouts::tiny_timeout_ms()); Echo(method_call, response_sender); } |