diff options
Diffstat (limited to 'content')
127 files changed, 562 insertions, 378 deletions
diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h index e5f73e1..c941297 100644 --- a/content/browser/appcache/chrome_appcache_service.h +++ b/content/browser/appcache/chrome_appcache_service.h @@ -8,8 +8,8 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "webkit/appcache/appcache_policy.h" diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc index 0ea064f..4df4a6e 100644 --- a/content/browser/appcache/chrome_appcache_service_unittest.cc +++ b/content/browser/appcache/chrome_appcache_service_unittest.cc @@ -7,7 +7,7 @@ #include "base/message_loop.h" #include "base/scoped_temp_dir.h" #include "content/browser/appcache/chrome_appcache_service.h" -#include "content/browser/browser_thread.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/appcache/appcache_database.h" #include "webkit/appcache/appcache_storage_impl.h" @@ -56,10 +56,10 @@ class ChromeAppCacheServiceTest : public testing::Test { const GURL kSessionOnlyManifestURL; private: - BrowserThread db_thread_; - BrowserThread file_thread_; - BrowserThread cache_thread_; - BrowserThread io_thread_; + content::TestBrowserThread db_thread_; + content::TestBrowserThread file_thread_; + content::TestBrowserThread cache_thread_; + content::TestBrowserThread io_thread_; }; scoped_refptr<ChromeAppCacheService> diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc index 53276e6..532b2cd 100644 --- a/content/browser/browser_child_process_host.cc +++ b/content/browser/browser_child_process_host.cc @@ -13,13 +13,13 @@ #include "base/process_util.h" #include "base/stl_util.h" #include "base/string_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/resource_message_filter.h" #include "content/browser/trace_message_filter.h" -#include "content/public/browser/notification_service.h" #include "content/common/plugin_messages.h" #include "content/common/process_watcher.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc index 9627f36..3609290 100644 --- a/content/browser/browser_main.cc +++ b/content/browser/browser_main.cc @@ -10,7 +10,6 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "content/browser/browser_main_loop.h" -#include "content/browser/browser_thread.h" #include "content/browser/notification_service_impl.h" #include "content/common/main_function_params.h" #include "content/public/common/content_switches.h" diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 944d40c..f9b1102 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -12,7 +12,7 @@ #include "base/metrics/histogram.h" #include "base/threading/thread_restrictions.h" #include "base/tracked_objects.h" -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" #include "content/common/hi_res_timer_manager.h" #include "content/common/main_function_params.h" #include "content/common/sandbox_policy.h" @@ -239,6 +239,9 @@ void BrowserMainLoop::MainMessageLoopStart() { } #endif + // Must first NULL pointer or we hit a DCHECK that the newly constructed + // message loop is the current one. + main_message_loop_.reset(); main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); InitializeMainThread(); @@ -295,8 +298,8 @@ void BrowserMainLoop::InitializeMainThread() { #endif // TRACK_ALL_TASK_OBJECTS // Register the main thread by instantiating it, but don't call any methods. - main_thread_.reset(new BrowserThread(BrowserThread::UI, - MessageLoop::current())); + main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, + MessageLoop::current())); } void BrowserMainLoop::InitializeToolkit() { diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index e9f67a6..32d0c58 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h @@ -11,7 +11,6 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -class BrowserThread; class CommandLine; class HighResolutionTimerManager; class MessageLoop; @@ -29,6 +28,7 @@ class NetworkChangeNotifier; namespace content { class BrowserMainParts; +class BrowserThreadImpl; // Implements the main browser loop stages called from |BrowserMain()|. // See comments in browser_main_parts.h for additional info. @@ -65,7 +65,7 @@ class BrowserMainLoop { scoped_ptr<base::SystemMonitor> system_monitor_; scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; - scoped_ptr<BrowserThread> main_thread_; + scoped_ptr<BrowserThreadImpl> main_thread_; DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); }; diff --git a/content/browser/browser_message_filter.h b/content/browser/browser_message_filter.h index 2ad88b8..69223f0 100644 --- a/content/browser/browser_message_filter.h +++ b/content/browser/browser_message_filter.h @@ -7,8 +7,8 @@ #pragma once #include "base/process.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "ipc/ipc_channel_proxy.h" // Base class for message filters in the browser process. You can receive and diff --git a/content/browser/browser_process_sub_thread.cc b/content/browser/browser_process_sub_thread.cc index f748d08..31c129e 100644 --- a/content/browser/browser_process_sub_thread.cc +++ b/content/browser/browser_process_sub_thread.cc @@ -11,8 +11,10 @@ #include <Objbase.h> #endif +namespace content { + BrowserProcessSubThread::BrowserProcessSubThread(BrowserThread::ID identifier) - : BrowserThread(identifier) {} + : BrowserThreadImpl(identifier) {} BrowserProcessSubThread::~BrowserProcessSubThread() { // We cannot rely on our base class to stop the thread since we want our @@ -39,3 +41,5 @@ void BrowserProcessSubThread::CleanUp() { CoUninitialize(); #endif } + +} // namespace content diff --git a/content/browser/browser_process_sub_thread.h b/content/browser/browser_process_sub_thread.h index adbda97..ac3f8560 100644 --- a/content/browser/browser_process_sub_thread.h +++ b/content/browser/browser_process_sub_thread.h @@ -7,13 +7,15 @@ #pragma once #include "base/basictypes.h" -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" #include "content/common/content_export.h" namespace content { class NotificationService; } +namespace content { + // ---------------------------------------------------------------------------- // BrowserProcessSubThread // @@ -23,7 +25,7 @@ class NotificationService; // Applications must initialize the COM library before they can call // COM library functions other than CoGetMalloc and memory allocation // functions, so this class initializes COM for those users. -class CONTENT_EXPORT BrowserProcessSubThread : public BrowserThread { +class CONTENT_EXPORT BrowserProcessSubThread : public BrowserThreadImpl { public: explicit BrowserProcessSubThread(BrowserThread::ID identifier); virtual ~BrowserProcessSubThread(); @@ -36,9 +38,11 @@ class CONTENT_EXPORT BrowserProcessSubThread : public BrowserThread { // Each specialized thread has its own notification service. // Note: We don't use scoped_ptr because the destructor runs on the wrong // thread. - content::NotificationService* notification_service_; + NotificationService* notification_service_; DISALLOW_COPY_AND_ASSIGN(BrowserProcessSubThread); }; +} // namespace content + #endif // CONTENT_BROWSER_BROWSER_PROCESS_SUB_THREAD_H_ diff --git a/content/browser/browser_thread.cc b/content/browser/browser_thread_impl.cc index c3b4005..39fa636 100644 --- a/content/browser/browser_thread.cc +++ b/content/browser/browser_thread_impl.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" #include "base/bind.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "base/threading/thread_restrictions.h" +namespace { + // Friendly names for the well-known threads. static const char* browser_thread_names[BrowserThread::ID_COUNT] = { "", // UI (name assembled in browser_main.cc). @@ -23,6 +25,120 @@ static const char* browser_thread_names[BrowserThread::ID_COUNT] = { #endif }; +} // namespace + +namespace content { + +base::Lock BrowserThreadImpl::lock_; + +BrowserThread* BrowserThreadImpl::browser_threads_[ID_COUNT]; + +BrowserThreadImpl::BrowserThreadImpl(BrowserThread::ID identifier) + : BrowserThread(identifier) { +} + +BrowserThreadImpl::BrowserThreadImpl(BrowserThread::ID identifier, + MessageLoop* message_loop) + : BrowserThread(identifier, message_loop) { +} + +BrowserThreadImpl::~BrowserThreadImpl() { +} + +// static +bool BrowserThreadImpl::PostTaskHelper( + BrowserThread::ID identifier, + const tracked_objects::Location& from_here, + Task* task, + int64 delay_ms, + bool nestable) { + DCHECK(identifier >= 0 && identifier < ID_COUNT); + // Optimization: to avoid unnecessary locks, we listed the ID enumeration in + // order of lifetime. So no need to lock if we know that the other thread + // outlives this one. + // Note: since the array is so small, ok to loop instead of creating a map, + // which would require a lock because std::map isn't thread safe, defeating + // the whole purpose of this optimization. + BrowserThread::ID current_thread; + bool guaranteed_to_outlive_target_thread = + GetCurrentThreadIdentifier(¤t_thread) && + current_thread >= identifier; + + if (!guaranteed_to_outlive_target_thread) + BrowserThreadImpl::lock_.Acquire(); + + MessageLoop* message_loop = BrowserThreadImpl::browser_threads_[identifier] ? + BrowserThreadImpl::browser_threads_[identifier]->message_loop() : NULL; + if (message_loop) { + if (nestable) { + message_loop->PostDelayedTask(from_here, task, delay_ms); + } else { + message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); + } + } + + if (!guaranteed_to_outlive_target_thread) + BrowserThreadImpl::lock_.Release(); + + if (!message_loop) + delete task; + + return !!message_loop; +} + +// static +bool BrowserThreadImpl::PostTaskHelper( + BrowserThread::ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms, + bool nestable) { + DCHECK(identifier >= 0 && identifier < ID_COUNT); + // Optimization: to avoid unnecessary locks, we listed the ID enumeration in + // order of lifetime. So no need to lock if we know that the other thread + // outlives this one. + // Note: since the array is so small, ok to loop instead of creating a map, + // which would require a lock because std::map isn't thread safe, defeating + // the whole purpose of this optimization. + BrowserThread::ID current_thread; + bool guaranteed_to_outlive_target_thread = + GetCurrentThreadIdentifier(¤t_thread) && + current_thread >= identifier; + + if (!guaranteed_to_outlive_target_thread) + lock_.Acquire(); + + MessageLoop* message_loop = browser_threads_[identifier] ? + browser_threads_[identifier]->message_loop() : NULL; + if (message_loop) { + if (nestable) { + message_loop->PostDelayedTask(from_here, task, delay_ms); + } else { + message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); + } + } + + if (!guaranteed_to_outlive_target_thread) + lock_.Release(); + + return !!message_loop; +} + +} // namespace content + +using content::BrowserThreadImpl; + +// TODO(joi): Remove +DeprecatedBrowserThread::DeprecatedBrowserThread(BrowserThread::ID identifier) + : BrowserThread(identifier) { +} +DeprecatedBrowserThread::DeprecatedBrowserThread(BrowserThread::ID identifier, + MessageLoop* message_loop) + : BrowserThread(identifier, message_loop) { +} +DeprecatedBrowserThread::~DeprecatedBrowserThread() { +} + // An implementation of MessageLoopProxy to be used in conjunction // with BrowserThread. class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy { @@ -87,18 +203,14 @@ class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy { DISALLOW_COPY_AND_ASSIGN(BrowserThreadMessageLoopProxy); }; - -base::Lock BrowserThread::lock_; - -BrowserThread* BrowserThread::browser_threads_[ID_COUNT]; - -BrowserThread::BrowserThread(BrowserThread::ID identifier) +BrowserThread::BrowserThread(ID identifier) : Thread(browser_thread_names[identifier]), identifier_(identifier) { Initialize(); } -BrowserThread::BrowserThread(ID identifier, MessageLoop* message_loop) +BrowserThread::BrowserThread(ID identifier, + MessageLoop* message_loop) : Thread(message_loop->thread_name().c_str()), identifier_(identifier) { set_message_loop(message_loop); @@ -106,10 +218,10 @@ BrowserThread::BrowserThread(ID identifier, MessageLoop* message_loop) } void BrowserThread::Initialize() { - base::AutoLock lock(lock_); + base::AutoLock lock(BrowserThreadImpl::lock_); DCHECK(identifier_ >= 0 && identifier_ < ID_COUNT); - DCHECK(browser_threads_[identifier_] == NULL); - browser_threads_[identifier_] = this; + DCHECK(BrowserThreadImpl::browser_threads_[identifier_] == NULL); + BrowserThreadImpl::browser_threads_[identifier_] = this; } BrowserThread::~BrowserThread() { @@ -118,12 +230,12 @@ BrowserThread::~BrowserThread() { // correct BrowserThread succeeds. Stop(); - base::AutoLock lock(lock_); - browser_threads_[identifier_] = NULL; + base::AutoLock lock(BrowserThreadImpl::lock_); + BrowserThreadImpl::browser_threads_[identifier_] = NULL; #ifndef NDEBUG // Double check that the threads are ordered correctly in the enumeration. for (int i = identifier_ + 1; i < ID_COUNT; ++i) { - DCHECK(!browser_threads_[i]) << + DCHECK(!BrowserThreadImpl::browser_threads_[i]) << "Threads must be listed in the reverse order that they die"; } #endif @@ -131,9 +243,9 @@ BrowserThread::~BrowserThread() { // static bool BrowserThread::IsWellKnownThread(ID identifier) { - base::AutoLock lock(lock_); + base::AutoLock lock(BrowserThreadImpl::lock_); return (identifier >= 0 && identifier < ID_COUNT && - browser_threads_[identifier]); + BrowserThreadImpl::browser_threads_[identifier]); } // static @@ -143,33 +255,36 @@ bool BrowserThread::CurrentlyOn(ID identifier) { // function. // http://crbug.com/63678 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; - base::AutoLock lock(lock_); + base::AutoLock lock(BrowserThreadImpl::lock_); DCHECK(identifier >= 0 && identifier < ID_COUNT); - return browser_threads_[identifier] && - browser_threads_[identifier]->message_loop() == MessageLoop::current(); + return BrowserThreadImpl::browser_threads_[identifier] && + BrowserThreadImpl::browser_threads_[identifier]->message_loop() == + MessageLoop::current(); } // static bool BrowserThread::IsMessageLoopValid(ID identifier) { - base::AutoLock lock(lock_); + base::AutoLock lock(BrowserThreadImpl::lock_); DCHECK(identifier >= 0 && identifier < ID_COUNT); - return browser_threads_[identifier] && - browser_threads_[identifier]->message_loop(); + return BrowserThreadImpl::browser_threads_[identifier] && + BrowserThreadImpl::browser_threads_[identifier]->message_loop(); } // static bool BrowserThread::PostTask(ID identifier, - const tracked_objects::Location& from_here, - const base::Closure& task) { - return PostTaskHelper(identifier, from_here, task, 0, true); + const tracked_objects::Location& from_here, + const base::Closure& task) { + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, 0, true); } // static bool BrowserThread::PostDelayedTask(ID identifier, - const tracked_objects::Location& from_here, - const base::Closure& task, - int64 delay_ms) { - return PostTaskHelper(identifier, from_here, task, delay_ms, true); + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms) { + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, delay_ms, true); } // static @@ -177,7 +292,8 @@ bool BrowserThread::PostNonNestableTask( ID identifier, const tracked_objects::Location& from_here, const base::Closure& task) { - return PostTaskHelper(identifier, from_here, task, 0, false); + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, 0, false); } // static @@ -186,22 +302,25 @@ bool BrowserThread::PostNonNestableDelayedTask( const tracked_objects::Location& from_here, const base::Closure& task, int64 delay_ms) { - return PostTaskHelper(identifier, from_here, task, delay_ms, false); + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, delay_ms, false); } // static bool BrowserThread::PostTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task) { - return PostTaskHelper(identifier, from_here, task, 0, true); + const tracked_objects::Location& from_here, + Task* task) { + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, 0, true); } // static bool BrowserThread::PostDelayedTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms) { - return PostTaskHelper(identifier, from_here, task, delay_ms, true); + const tracked_objects::Location& from_here, + Task* task, + int64 delay_ms) { + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, delay_ms, true); } // static @@ -209,7 +328,8 @@ bool BrowserThread::PostNonNestableTask( ID identifier, const tracked_objects::Location& from_here, Task* task) { - return PostTaskHelper(identifier, from_here, task, 0, false); + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, 0, false); } // static @@ -218,7 +338,8 @@ bool BrowserThread::PostNonNestableDelayedTask( const tracked_objects::Location& from_here, Task* task, int64 delay_ms) { - return PostTaskHelper(identifier, from_here, task, delay_ms, false); + return BrowserThreadImpl::PostTaskHelper( + identifier, from_here, task, delay_ms, false); } // static @@ -241,9 +362,10 @@ bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; MessageLoop* cur_message_loop = MessageLoop::current(); for (int i = 0; i < ID_COUNT; ++i) { - if (browser_threads_[i] && - browser_threads_[i]->message_loop() == cur_message_loop) { - *identifier = browser_threads_[i]->identifier_; + if (BrowserThreadImpl::browser_threads_[i] && + BrowserThreadImpl::browser_threads_[i]->message_loop() == + cur_message_loop) { + *identifier = BrowserThreadImpl::browser_threads_[i]->identifier_; return true; } } @@ -259,82 +381,3 @@ BrowserThread::GetMessageLoopProxyForThread( new BrowserThreadMessageLoopProxy(identifier)); return proxy; } - -// static -bool BrowserThread::PostTaskHelper( - ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms, - bool nestable) { - DCHECK(identifier >= 0 && identifier < ID_COUNT); - // Optimization: to avoid unnecessary locks, we listed the ID enumeration in - // order of lifetime. So no need to lock if we know that the other thread - // outlives this one. - // Note: since the array is so small, ok to loop instead of creating a map, - // which would require a lock because std::map isn't thread safe, defeating - // the whole purpose of this optimization. - ID current_thread; - bool guaranteed_to_outlive_target_thread = - GetCurrentThreadIdentifier(¤t_thread) && - current_thread >= identifier; - - if (!guaranteed_to_outlive_target_thread) - lock_.Acquire(); - - MessageLoop* message_loop = browser_threads_[identifier] ? - browser_threads_[identifier]->message_loop() : NULL; - if (message_loop) { - if (nestable) { - message_loop->PostDelayedTask(from_here, task, delay_ms); - } else { - message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); - } - } - - if (!guaranteed_to_outlive_target_thread) - lock_.Release(); - - if (!message_loop) - delete task; - - return !!message_loop; -} - -// static -bool BrowserThread::PostTaskHelper( - ID identifier, - const tracked_objects::Location& from_here, - const base::Closure& task, - int64 delay_ms, - bool nestable) { - DCHECK(identifier >= 0 && identifier < ID_COUNT); - // Optimization: to avoid unnecessary locks, we listed the ID enumeration in - // order of lifetime. So no need to lock if we know that the other thread - // outlives this one. - // Note: since the array is so small, ok to loop instead of creating a map, - // which would require a lock because std::map isn't thread safe, defeating - // the whole purpose of this optimization. - ID current_thread; - bool guaranteed_to_outlive_target_thread = - GetCurrentThreadIdentifier(¤t_thread) && - current_thread >= identifier; - - if (!guaranteed_to_outlive_target_thread) - lock_.Acquire(); - - MessageLoop* message_loop = browser_threads_[identifier] ? - browser_threads_[identifier]->message_loop() : NULL; - if (message_loop) { - if (nestable) { - message_loop->PostDelayedTask(from_here, task, delay_ms); - } else { - message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); - } - } - - if (!guaranteed_to_outlive_target_thread) - lock_.Release(); - - return !!message_loop; -} diff --git a/content/browser/browser_thread_impl.h b/content/browser/browser_thread_impl.h new file mode 100644 index 0000000..5c19e92 --- /dev/null +++ b/content/browser/browser_thread_impl.h @@ -0,0 +1,53 @@ +// 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. + +#ifndef CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ +#define CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ +#pragma once + +#include "content/public/browser/browser_thread.h" + +namespace content { + +class BrowserThreadImpl : public BrowserThread { + public: + explicit BrowserThreadImpl(BrowserThread::ID identifier); + BrowserThreadImpl(BrowserThread::ID identifier, MessageLoop* message_loop); + virtual ~BrowserThreadImpl(); + + private: + // We implement most functionality on the public set of + // BrowserThread functions, but state is stored in the + // BrowserThreadImpl to keep the public API cleaner. Therefore make + // BrowserThread a friend class. + friend class BrowserThread; + + // TODO(brettw) remove this variant when Task->Closure migration is complete. + static bool PostTaskHelper( + BrowserThread::ID identifier, + const tracked_objects::Location& from_here, + Task* task, + int64 delay_ms, + bool nestable); + static bool PostTaskHelper( + BrowserThread::ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms, + bool nestable); + + // This lock protects |browser_threads_|. Do not read or modify that array + // without holding this lock. Do not block while holding this lock. + static base::Lock lock_; + + // An array of the BrowserThread objects. This array is protected by |lock_|. + // The threads are not owned by this array. Typically, the threads are owned + // on the UI thread by the g_browser_process object. BrowserThreads remove + // themselves from this array upon destruction. + static BrowserThread* browser_threads_[ID_COUNT]; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc index f5f6e47..11ccecc 100644 --- a/content/browser/browser_thread_unittest.cc +++ b/content/browser/browser_thread_unittest.cc @@ -6,10 +6,13 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +namespace content { + class BrowserThreadTest : public testing::Test { public: void Release() const { @@ -19,8 +22,8 @@ class BrowserThreadTest : public testing::Test { protected: virtual void SetUp() { - ui_thread_.reset(new BrowserThread(BrowserThread::UI)); - file_thread_.reset(new BrowserThread(BrowserThread::FILE)); + ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI)); + file_thread_.reset(new BrowserThreadImpl(BrowserThread::FILE)); ui_thread_->Start(); file_thread_->Start(); } @@ -79,8 +82,8 @@ class BrowserThreadTest : public testing::Test { }; private: - scoped_ptr<BrowserThread> ui_thread_; - scoped_ptr<BrowserThread> file_thread_; + scoped_ptr<BrowserThreadImpl> ui_thread_; + scoped_ptr<BrowserThreadImpl> file_thread_; // It's kind of ugly to make this mutable - solely so we can post the Quit // Task from Release(). This should be fixed. mutable MessageLoop loop_; @@ -156,7 +159,8 @@ TEST_F(BrowserThreadTest, TaskToNonExistentThreadIsDeletedViaMessageLoopProxy) { } TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadExits) { - scoped_ptr<BrowserThread> io_thread(new BrowserThread(BrowserThread::IO)); + scoped_ptr<BrowserThreadImpl> io_thread( + new BrowserThreadImpl(BrowserThread::IO)); io_thread->Start(); io_thread->Stop(); @@ -170,7 +174,8 @@ TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadExits) { TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadIsDeleted) { { - scoped_ptr<BrowserThread> io_thread(new BrowserThread(BrowserThread::IO)); + scoped_ptr<BrowserThreadImpl> io_thread( + new BrowserThreadImpl(BrowserThread::IO)); io_thread->Start(); } bool deleted = false; @@ -180,3 +185,5 @@ TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadIsDeleted) { EXPECT_FALSE(ret); EXPECT_TRUE(deleted); } + +} diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index ea65150..e487c0d 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc @@ -12,9 +12,9 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "base/threading/thread.h" -#include "content/browser/browser_thread.h" #include "content/common/chrome_descriptors.h" #include "content/common/process_watcher.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" @@ -26,8 +26,8 @@ #include "content/browser/mach_broker_mac.h" #elif defined(OS_POSIX) #include "base/memory/singleton.h" -#include "content/browser/zygote_host_linux.h" #include "content/browser/renderer_host/render_sandbox_host_linux.h" +#include "content/browser/zygote_host_linux.h" #endif #if defined(OS_POSIX) diff --git a/content/browser/chrome_blob_storage_context.h b/content/browser/chrome_blob_storage_context.h index a6680f9..8375833 100644 --- a/content/browser/chrome_blob_storage_context.h +++ b/content/browser/chrome_blob_storage_context.h @@ -8,8 +8,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" class GURL; diff --git a/content/browser/debugger/devtools_http_protocol_handler.cc b/content/browser/debugger/devtools_http_protocol_handler.cc index c44594ee..9117ee6 100644 --- a/content/browser/debugger/devtools_http_protocol_handler.cc +++ b/content/browser/debugger/devtools_http_protocol_handler.cc @@ -15,12 +15,12 @@ #include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/browser_thread.h" #include "content/browser/debugger/devtools_client_host.h" #include "content/browser/debugger/devtools_manager.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_observer.h" #include "content/common/devtools_messages.h" +#include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" diff --git a/content/browser/debugger/devtools_manager.cc b/content/browser/debugger/devtools_manager.cc index 1cf27bd..aaddf98 100644 --- a/content/browser/debugger/devtools_manager.cc +++ b/content/browser/debugger/devtools_manager.cc @@ -7,7 +7,6 @@ #include <vector> #include "base/message_loop.h" -#include "content/browser/browser_thread.h" #include "content/browser/browsing_instance.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/debugger/devtools_client_host.h" @@ -15,6 +14,7 @@ #include "content/browser/debugger/render_view_devtools_agent_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "googleurl/src/gurl.h" diff --git a/content/browser/debugger/devtools_netlog_observer.cc b/content/browser/debugger/devtools_netlog_observer.cc index 2aa2663..53d1fbd4 100644 --- a/content/browser/debugger/devtools_netlog_observer.cc +++ b/content/browser/debugger/devtools_netlog_observer.cc @@ -7,8 +7,8 @@ #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/values.h" -#include "content/browser/browser_thread.h" #include "content/common/resource_response.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "net/base/load_flags.h" #include "net/http/http_net_log_params.h" diff --git a/content/browser/debugger/worker_devtools_manager.cc b/content/browser/debugger/worker_devtools_manager.cc index a695c6a..4ec08ce 100644 --- a/content/browser/debugger/worker_devtools_manager.cc +++ b/content/browser/debugger/worker_devtools_manager.cc @@ -8,13 +8,13 @@ #include <map> #include "base/tuple.h" -#include "content/browser/browser_thread.h" #include "content/browser/debugger/devtools_agent_host.h" #include "content/browser/debugger/devtools_manager.h" #include "content/browser/debugger/worker_devtools_message_filter.h" #include "content/browser/worker_host/worker_process_host.h" #include "content/browser/worker_host/worker_service.h" #include "content/common/devtools_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" diff --git a/content/browser/device_orientation/message_filter.cc b/content/browser/device_orientation/message_filter.cc index 0953dd2..46e0647b 100644 --- a/content/browser/device_orientation/message_filter.cc +++ b/content/browser/device_orientation/message_filter.cc @@ -5,12 +5,12 @@ #include "content/browser/device_orientation/message_filter.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/browser_thread.h" #include "content/browser/device_orientation/orientation.h" #include "content/browser/device_orientation/provider.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_notification_task.h" #include "content/common/device_orientation_messages.h" +#include "content/public/browser/browser_thread.h" namespace device_orientation { diff --git a/content/browser/device_orientation/provider.cc b/content/browser/device_orientation/provider.cc index e10da2b..c1cd32f 100644 --- a/content/browser/device_orientation/provider.cc +++ b/content/browser/device_orientation/provider.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2010 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. #include "content/browser/device_orientation/provider.h" #include "base/logging.h" -#include "content/browser/browser_thread.h" #include "content/browser/device_orientation/data_fetcher.h" #include "content/browser/device_orientation/provider_impl.h" +#include "content/public/browser/browser_thread.h" #if defined(OS_MACOSX) #include "content/browser/device_orientation/accelerometer_mac.h" diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc index 9683b50..25c2434 100644 --- a/content/browser/download/base_file.cc +++ b/content/browser/download/base_file.cc @@ -10,8 +10,8 @@ #include "base/stringprintf.h" #include "base/threading/thread_restrictions.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_stats.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "crypto/secure_hash.h" #include "net/base/file_stream.h" diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index c55696c..ee518c3 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -10,7 +10,7 @@ #include "base/scoped_temp_dir.h" #include "base/string_number_conversions.h" #include "base/test/test_file_util.h" -#include "content/browser/browser_thread.h" +#include "content/test/test_browser_thread.h" #include "net/base/file_stream.h" #include "net/base/mock_file_stream.h" #include "net/base/net_errors.h" @@ -162,7 +162,7 @@ class BaseFileTest : public testing::Test { // Mock file thread to satisfy debug checks in BaseFile. MessageLoop message_loop_; - BrowserThread file_thread_; + content::TestBrowserThread file_thread_; }; // Test the most basic scenario: just create the object and do a sanity check diff --git a/content/browser/download/download_file.cc b/content/browser/download/download_file.cc index 147c7fe..a2bfb34 100644 --- a/content/browser/download/download_file.cc +++ b/content/browser/download/download_file.cc @@ -8,9 +8,9 @@ #include "base/file_util.h" #include "base/stringprintf.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_manager.h" +#include "content/public/browser/browser_thread.h" namespace { diff --git a/content/browser/download/download_file_manager.cc b/content/browser/download/download_file_manager.cc index e6ecc9f..b9d9362 100644 --- a/content/browser/download/download_file_manager.cc +++ b/content/browser/download/download_file_manager.cc @@ -9,7 +9,6 @@ #include "base/stl_util.h" #include "base/task.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_buffer.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file.h" @@ -17,6 +16,7 @@ #include "content/browser/download/download_request_handle.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager_delegate.h" #include "googleurl/src/gurl.h" #include "net/base/io_buffer.h" diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 7851d34..44fb740 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -5,7 +5,6 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file.h" #include "content/browser/download/download_manager.h" @@ -13,6 +12,7 @@ #include "content/browser/download/download_status_updater.h" #include "content/browser/download/mock_download_manager.h" #include "content/browser/download/mock_download_manager_delegate.h" +#include "content/test/test_browser_thread.h" #include "net/base/file_stream.h" #include "net/base/net_errors.h" #include "testing/gtest/include/gtest/gtest.h" @@ -105,9 +105,9 @@ class DownloadFileTest : public testing::Test { private: MessageLoop loop_; // UI thread. - BrowserThread ui_thread_; + content::TestBrowserThread ui_thread_; // File thread to satisfy debug checks in DownloadFile. - BrowserThread file_thread_; + content::TestBrowserThread file_thread_; // Keep track of what data should be saved to the disk file. std::string expected_data_; diff --git a/content/browser/download/download_id_unittest.cc b/content/browser/download/download_id_unittest.cc index 39d9f3b..2e09525 100644 --- a/content/browser/download/download_id_unittest.cc +++ b/content/browser/download/download_id_unittest.cc @@ -9,8 +9,9 @@ #include <set> #include <vector> -#include "content/browser/download/mock_download_manager_delegate.h" #include "content/browser/download/mock_download_manager.h" +#include "content/browser/download/mock_download_manager_delegate.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" class DownloadIdTest : public testing::Test { @@ -45,7 +46,8 @@ class DownloadIdTest : public testing::Test { scoped_ptr<MockDownloadManagerDelegate> download_manager_delegate_; scoped_refptr<DownloadManager> download_managers_[2]; MessageLoopForUI message_loop_; - BrowserThread ui_thread_; // Necessary to delete |DownloadManager|s. + // Necessary to delete |DownloadManager|s. + content::TestBrowserThread ui_thread_; size_t num_managers_; DISALLOW_COPY_AND_ASSIGN(DownloadIdTest); diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc index 84387b6..d684930 100644 --- a/content/browser/download/download_item.cc +++ b/content/browser/download/download_item.cc @@ -14,10 +14,8 @@ #include "base/stringprintf.h" #include "base/timer.h" #include "base/utf_string_conversions.h" -#include "net/base/net_util.h" -#include "content/browser/browser_thread.h" -#include "content/browser/download/download_file.h" #include "content/browser/download/download_create_info.h" +#include "content/browser/download/download_file.h" #include "content/browser/download/download_file_manager.h" #include "content/browser/download/download_id.h" #include "content/browser/download/download_manager.h" @@ -25,8 +23,10 @@ #include "content/browser/download/download_request_handle.h" #include "content/browser/download/download_stats.h" #include "content/browser/download/interrupt_reasons.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_manager_delegate.h" +#include "net/base/net_util.h" // A DownloadItem normally goes through the following states: // * Created (when download starts) diff --git a/content/browser/download/download_manager.cc b/content/browser/download/download_manager.cc index 890c9bc..37054dc 100644 --- a/content/browser/download/download_manager.cc +++ b/content/browser/download/download_manager.cc @@ -18,7 +18,6 @@ #include "base/task.h" #include "build/build_config.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file_manager.h" #include "content/browser/download/download_item.h" @@ -30,6 +29,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_manager_delegate.h" #include "content/public/browser/notification_service.h" diff --git a/content/browser/download/download_manager.h b/content/browser/download/download_manager.h index d727798..9255058 100644 --- a/content/browser/download/download_manager.h +++ b/content/browser/download/download_manager.h @@ -44,11 +44,11 @@ #include "base/observer_list.h" #include "base/synchronization/lock.h" #include "base/time.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_item.h" #include "content/browser/download/download_status_updater_delegate.h" #include "content/browser/download/interrupt_reasons.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "net/base/net_errors.h" class DownloadFileManager; diff --git a/content/browser/download/download_request_handle.cc b/content/browser/download/download_request_handle.cc index de6d5aa..6b38e30 100644 --- a/content/browser/download/download_request_handle.cc +++ b/content/browser/download/download_request_handle.cc @@ -6,10 +6,10 @@ #include "base/stringprintf.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" // IO Thread indirections to resource dispatcher host. // Provided as targets for PostTask from within this object diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc index d7b5211..7450450 100644 --- a/content/browser/download/download_resource_handler.cc +++ b/content/browser/download/download_resource_handler.cc @@ -10,7 +10,6 @@ #include "base/metrics/histogram.h" #include "base/metrics/stats_counters.h" #include "base/stringprintf.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_buffer.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file_manager.h" @@ -23,6 +22,7 @@ #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/common/resource_response.h" +#include "content/public/browser/browser_thread.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc index 69ce7a1..2b578c7 100644 --- a/content/browser/download/drag_download_file.cc +++ b/content/browser/download/drag_download_file.cc @@ -7,10 +7,10 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_item.h" #include "content/browser/download/download_stats.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "net/base/file_stream.h" DragDownloadFile::DragDownloadFile( diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc index 99d185a..1483d06 100644 --- a/content/browser/download/drag_download_util.cc +++ b/content/browser/download/drag_download_util.cc @@ -4,14 +4,14 @@ #include "content/browser/download/drag_download_util.h" -#include "base/string_util.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/memory/scoped_ptr.h" -#include "base/task.h" #include "base/string_number_conversions.h" +#include "base/string_util.h" +#include "base/task.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "net/base/file_stream.h" #include "net/base/net_errors.h" diff --git a/content/browser/download/mhtml_generation_manager.h b/content/browser/download/mhtml_generation_manager.h index 47c847e..704e2ee 100644 --- a/content/browser/download/mhtml_generation_manager.h +++ b/content/browser/download/mhtml_generation_manager.h @@ -10,8 +10,8 @@ #include "base/memory/ref_counted.h" #include "base/platform_file.h" #include "base/process.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "ipc/ipc_platform_file.h" class FilePath; diff --git a/content/browser/download/save_file.cc b/content/browser/download/save_file.cc index 40c6c35..c03abc7 100644 --- a/content/browser/download/save_file.cc +++ b/content/browser/download/save_file.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2010 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. #include "content/browser/download/save_file.h" #include "base/logging.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" #include "net/base/file_stream.h" SaveFile::SaveFile(const SaveFileCreateInfo* info) diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc index 88dc90e..26e7664 100644 --- a/content/browser/download/save_file_manager.cc +++ b/content/browser/download/save_file_manager.cc @@ -12,15 +12,15 @@ #include "base/stl_util.h" #include "base/string_util.h" #include "base/threading/thread.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/save_file.h" #include "content/browser/download/save_package.h" -#include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" -#include "net/base/net_util.h" #include "net/base/io_buffer.h" +#include "net/base/net_util.h" SaveFileManager::SaveFileManager(ResourceDispatcherHost* rdh) : next_id_(0), diff --git a/content/browser/download/save_file_resource_handler.cc b/content/browser/download/save_file_resource_handler.cc index 4830c1d..67de144 100644 --- a/content/browser/download/save_file_resource_handler.cc +++ b/content/browser/download/save_file_resource_handler.cc @@ -8,8 +8,8 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/save_file_manager.h" +#include "content/public/browser/browser_thread.h" #include "net/base/io_buffer.h" #include "net/url_request/url_request_status.h" diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index be2c051..f510219 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -19,7 +19,6 @@ #include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_file_manager.h" #include "content/browser/download/download_item.h" #include "content/browser/download/download_manager.h" @@ -32,6 +31,7 @@ #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_manager_delegate.h" #include "content/public/common/url_constants.h" diff --git a/content/browser/download/save_package_unittest.cc b/content/browser/download/save_package_unittest.cc index 23b62da..d8750e7 100644 --- a/content/browser/download/save_package_unittest.cc +++ b/content/browser/download/save_package_unittest.cc @@ -9,11 +9,11 @@ #include "base/scoped_temp_dir.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/save_package.h" #include "content/browser/net/url_request_mock_http_job.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/tab_contents/test_tab_contents.h" +#include "content/test/test_browser_thread.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" @@ -119,7 +119,7 @@ class SavePackageTest : public RenderViewHostTestHarness { } private: - BrowserThread browser_thread_; + content::TestBrowserThread browser_thread_; // SavePackage for successfully generating file name. scoped_refptr<SavePackage> save_package_success_; diff --git a/content/browser/file_system/browser_file_system_helper.cc b/content/browser/file_system/browser_file_system_helper.cc index c28c537..0d0c0218 100644 --- a/content/browser/file_system/browser_file_system_helper.cc +++ b/content/browser/file_system/browser_file_system_helper.cc @@ -4,9 +4,9 @@ #include "content/browser/file_system/browser_file_system_helper.h" -#include "base/file_path.h" #include "base/command_line.h" -#include "content/browser/browser_thread.h" +#include "base/file_path.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "webkit/quota/quota_manager.h" diff --git a/content/browser/font_list_async.cc b/content/browser/font_list_async.cc index f24001f..51a5403 100644 --- a/content/browser/font_list_async.cc +++ b/content/browser/font_list_async.cc @@ -6,8 +6,8 @@ #include "base/bind.h" #include "base/values.h" -#include "content/browser/browser_thread.h" #include "content/common/font_list.h" +#include "content/public/browser/browser_thread.h" namespace content { diff --git a/content/browser/geolocation/core_location_data_provider_mac.h b/content/browser/geolocation/core_location_data_provider_mac.h index 24efb99..aa4eec3 100644 --- a/content/browser/geolocation/core_location_data_provider_mac.h +++ b/content/browser/geolocation/core_location_data_provider_mac.h @@ -12,8 +12,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_nsobject.h" -#include "content/browser/browser_thread.h" #include "content/common/geoposition.h" +#include "content/public/browser/browser_thread.h" #import <Foundation/Foundation.h> diff --git a/content/browser/geolocation/gps_location_provider_unittest_linux.cc b/content/browser/geolocation/gps_location_provider_unittest_linux.cc index f7bbd97..3116cf3 100644 --- a/content/browser/geolocation/gps_location_provider_unittest_linux.cc +++ b/content/browser/geolocation/gps_location_provider_unittest_linux.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/browser_thread.h" #include "content/browser/geolocation/gps_location_provider_linux.h" #include "content/browser/geolocation/libgps_wrapper_linux.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" struct gps_data_t { @@ -66,7 +66,7 @@ class GeolocationGpsProviderLinuxTests : public testing::Test { protected: MessageLoop message_loop_; - BrowserThread ui_thread_; + content::TestBrowserThread ui_thread_; LocaionProviderListenerLoopQuitter location_listener_; scoped_ptr<GpsLocationProviderLinux> provider_; }; diff --git a/content/browser/gpu/gpu_data_manager.cc b/content/browser/gpu/gpu_data_manager.cc index bae78d6..f6a514b 100644 --- a/content/browser/gpu/gpu_data_manager.cc +++ b/content/browser/gpu/gpu_data_manager.cc @@ -10,16 +10,16 @@ #include "base/command_line.h" #include "base/metrics/histogram.h" -#include "base/stringprintf.h" #include "base/string_number_conversions.h" +#include "base/stringprintf.h" #include "base/sys_info.h" #include "base/values.h" #include "base/version.h" -#include "content/browser/browser_thread.h" #include "content/browser/gpu/gpu_blacklist.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/common/gpu/gpu_messages.h" #include "content/gpu/gpu_info_collector.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "ui/gfx/gl/gl_implementation.h" diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 0d23a03..9909f75 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -13,7 +13,6 @@ #include "base/process_util.h" #include "base/string_piece.h" #include "base/threading/thread.h" -#include "content/browser/browser_thread.h" #include "content/browser/gpu/gpu_data_manager.h" #include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/renderer_host/render_widget_host.h" @@ -21,6 +20,7 @@ #include "content/common/gpu/gpu_messages.h" #include "content/gpu/gpu_child_thread.h" #include "content/gpu/gpu_process.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" #include "ipc/ipc_channel_handle.h" diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index df939bac..dc0057c 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -6,24 +6,24 @@ #include <algorithm> -#include "base/id_map.h" -#include "base/process_util.h" #include "base/debug/trace_event.h" +#include "base/id_map.h" #include "base/lazy_instance.h" -#include "content/browser/browser_thread.h" +#include "base/process_util.h" #include "content/browser/gpu/gpu_data_manager.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/common/gpu/gpu_messages.h" +#include "content/public/browser/browser_thread.h" #if defined(TOOLKIT_USES_GTK) // These two #includes need to come after gpu_messages.h. -#include <gdk/gdkwindow.h> // NOLINT -#include <gdk/gdkx.h> // NOLINT #include "ui/base/x/x11_util.h" #include "ui/gfx/size.h" +#include <gdk/gdkwindow.h> // NOLINT +#include <gdk/gdkx.h> // NOLINT #endif namespace { diff --git a/content/browser/host_zoom_map.cc b/content/browser/host_zoom_map.cc index 19b64f1..7d8904d 100644 --- a/content/browser/host_zoom_map.cc +++ b/content/browser/host_zoom_map.cc @@ -9,9 +9,9 @@ #include "base/string_piece.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "googleurl/src/gurl.h" diff --git a/content/browser/host_zoom_map.h b/content/browser/host_zoom_map.h index 57cfbba..d51e2c7 100644 --- a/content/browser/host_zoom_map.h +++ b/content/browser/host_zoom_map.h @@ -16,8 +16,8 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/content/browser/in_process_webkit/dom_storage_context.cc b/content/browser/in_process_webkit/dom_storage_context.cc index 80940bf..383568a 100644 --- a/content/browser/in_process_webkit/dom_storage_context.cc +++ b/content/browser/in_process_webkit/dom_storage_context.cc @@ -10,11 +10,11 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/string_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/dom_storage_area.h" #include "content/browser/in_process_webkit/dom_storage_namespace.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/common/dom_storage_common.h" +#include "content/public/browser/browser_thread.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "webkit/glue/webkit_glue.h" diff --git a/content/browser/in_process_webkit/dom_storage_message_filter.cc b/content/browser/in_process_webkit/dom_storage_message_filter.cc index fd65f89..2c19058 100644 --- a/content/browser/in_process_webkit/dom_storage_message_filter.cc +++ b/content/browser/in_process_webkit/dom_storage_message_filter.cc @@ -6,11 +6,11 @@ #include "base/bind.h" #include "base/nullable_string16.h" -#include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/dom_storage_area.h" #include "content/browser/in_process_webkit/dom_storage_context.h" #include "content/browser/in_process_webkit/dom_storage_namespace.h" #include "content/common/dom_storage_messages.h" +#include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" using WebKit::WebStorageArea; diff --git a/content/browser/in_process_webkit/dom_storage_unittest.cc b/content/browser/in_process_webkit/dom_storage_unittest.cc index 60875ce..d3438c5 100644 --- a/content/browser/in_process_webkit/dom_storage_unittest.cc +++ b/content/browser/in_process_webkit/dom_storage_unittest.cc @@ -6,6 +6,7 @@ #include "base/file_util.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/test/test_browser_context.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/quota/mock_special_storage_policy.h" @@ -20,7 +21,7 @@ class DOMStorageTest : public testing::Test { MessageLoop message_loop_; private: - BrowserThread webkit_thread_; + content::TestBrowserThread webkit_thread_; }; TEST_F(DOMStorageTest, SessionOnly) { diff --git a/content/browser/in_process_webkit/indexed_db_context.cc b/content/browser/in_process_webkit/indexed_db_context.cc index 5d7f0f5..d3c22d6 100644 --- a/content/browser/in_process_webkit/indexed_db_context.cc +++ b/content/browser/in_process_webkit/indexed_db_context.cc @@ -12,9 +12,9 @@ #include "base/string_util.h" #include "base/task.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/indexed_db_quota_client.h" #include "content/browser/in_process_webkit/webkit_context.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" diff --git a/content/browser/in_process_webkit/indexed_db_context.h b/content/browser/in_process_webkit/indexed_db_context.h index 19c6b91..12696a7 100644 --- a/content/browser/in_process_webkit/indexed_db_context.h +++ b/content/browser/in_process_webkit/indexed_db_context.h @@ -15,8 +15,8 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "webkit/quota/quota_types.h" diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 747a856..86e3e497 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -7,13 +7,13 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/indexed_db_callbacks.h" #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" #include "content/browser/renderer_host/render_message_filter.h" #include "content/browser/user_metrics.h" #include "content/common/indexed_db_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" #include "googleurl/src/gurl.h" @@ -21,9 +21,9 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc index 5fb7653..38f8cc2 100644 --- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc +++ b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc @@ -15,6 +15,7 @@ #include "content/browser/in_process_webkit/indexed_db_quota_client.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/test/test_browser_context.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/database/database_util.h" @@ -153,8 +154,8 @@ class IndexedDBQuotaClientTest : public testing::Test { scoped_refptr<IndexedDBContext> idb_context_; base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; MessageLoop message_loop_; - BrowserThread webkit_thread_; - BrowserThread io_thread_; + content::TestBrowserThread webkit_thread_; + content::TestBrowserThread io_thread_; quota::QuotaStatusCode delete_status_; }; diff --git a/content/browser/in_process_webkit/webkit_context.cc b/content/browser/in_process_webkit/webkit_context.cc index 37c4c54..04fdc53 100644 --- a/content/browser/in_process_webkit/webkit_context.cc +++ b/content/browser/in_process_webkit/webkit_context.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/command_line.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" WebKitContext::WebKitContext( bool is_incognito, const FilePath& data_path, diff --git a/content/browser/in_process_webkit/webkit_context_unittest.cc b/content/browser/in_process_webkit/webkit_context_unittest.cc index 2982e62..f03cbef 100644 --- a/content/browser/in_process_webkit/webkit_context_unittest.cc +++ b/content/browser/in_process_webkit/webkit_context_unittest.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/dom_storage_context.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/test/test_browser_context.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" class MockDOMStorageContext : public DOMStorageContext { @@ -47,7 +47,8 @@ TEST(WebKitContextTest, PurgeMemory) { // Start up a WebKit thread for the WebKitContext to call the // DOMStorageContext on. MessageLoop message_loop(MessageLoop::TYPE_DEFAULT); - BrowserThread webkit_thread(BrowserThread::WEBKIT, &message_loop); + content::TestBrowserThread webkit_thread(BrowserThread::WEBKIT, + &message_loop); { // Create the contexts. diff --git a/content/browser/in_process_webkit/webkit_thread.cc b/content/browser/in_process_webkit/webkit_thread.cc index 42f35be..128de28 100644 --- a/content/browser/in_process_webkit/webkit_thread.cc +++ b/content/browser/in_process_webkit/webkit_thread.cc @@ -37,7 +37,7 @@ void WebKitThread::Initialize() { } WebKitThread::InternalWebKitThread::InternalWebKitThread() - : BrowserThread(BrowserThread::WEBKIT) { + : content::BrowserThreadImpl(BrowserThread::WEBKIT) { } WebKitThread::InternalWebKitThread::~InternalWebKitThread() { diff --git a/content/browser/in_process_webkit/webkit_thread.h b/content/browser/in_process_webkit/webkit_thread.h index c6f34fc..5c62e2e 100644 --- a/content/browser/in_process_webkit/webkit_thread.h +++ b/content/browser/in_process_webkit/webkit_thread.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/threading/thread.h" -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" #include "content/common/content_export.h" class BrowserWebKitPlatformSupportImpl; @@ -25,7 +25,7 @@ class CONTENT_EXPORT WebKitThread { private: // Must be private so that we can carefully control its lifetime. - class InternalWebKitThread : public BrowserThread { + class InternalWebKitThread : public content::BrowserThreadImpl { public: InternalWebKitThread(); virtual ~InternalWebKitThread(); diff --git a/content/browser/mach_broker_mac.cc b/content/browser/mach_broker_mac.cc index 85fd3a8..d27c8ba 100644 --- a/content/browser/mach_broker_mac.cc +++ b/content/browser/mach_broker_mac.cc @@ -12,9 +12,9 @@ #include "base/stringprintf.h" #include "base/sys_string_conversions.h" #include "base/threading/platform_thread.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/common/child_process_info.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/common/content_switches.h" diff --git a/content/browser/net/url_request_slow_download_job.cc b/content/browser/net/url_request_slow_download_job.cc index a2bdf0ca..bbdcc44 100644 --- a/content/browser/net/url_request_slow_download_job.cc +++ b/content/browser/net/url_request_slow_download_job.cc @@ -7,9 +7,9 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/stringprintf.h" #include "base/string_util.h" -#include "content/browser/browser_thread.h" +#include "base/stringprintf.h" +#include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "net/base/io_buffer.h" #include "net/http/http_response_headers.h" diff --git a/content/browser/plugin_loader_posix.cc b/content/browser/plugin_loader_posix.cc index e27e543..613e125 100644 --- a/content/browser/plugin_loader_posix.cc +++ b/content/browser/plugin_loader_posix.cc @@ -8,8 +8,8 @@ #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "base/metrics/histogram.h" -#include "content/browser/browser_thread.h" #include "content/common/utility_messages.h" +#include "content/public/browser/browser_thread.h" #include "webkit/plugins/npapi/plugin_list.h" using webkit::npapi::PluginList; diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc index eb18428..d92eee0 100644 --- a/content/browser/plugin_loader_posix_unittest.cc +++ b/content/browser/plugin_loader_posix_unittest.cc @@ -6,12 +6,12 @@ #include "base/bind.h" #include "base/file_path.h" -#include "base/message_loop.h" #include "base/memory/ref_counted.h" +#include "base/message_loop.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "content/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" #include "webkit/plugins/webplugininfo.h" class MockPluginLoaderPosix : public PluginLoaderPosix { @@ -82,8 +82,8 @@ class PluginLoaderPosixTest : public testing::Test { private: MessageLoopForIO message_loop_; - BrowserThread file_thread_; - BrowserThread io_thread_; + content::TestBrowserThread file_thread_; + content::TestBrowserThread io_thread_; scoped_refptr<MockPluginLoaderPosix> plugin_loader_; }; diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 9da4b16..3207d35 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -20,18 +20,18 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_message_filter.h" #include "content/common/plugin_messages.h" #include "content/common/resource_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h" #include "ipc/ipc_switches.h" #include "ui/base/ui_base_switches.h" -#include "ui/gfx/native_widget_types.h" #include "ui/gfx/gl/gl_switches.h" +#include "ui/gfx/native_widget_types.h" #if defined(USE_X11) #include "ui/gfx/gtk_native_view_id_manager.h" diff --git a/content/browser/plugin_process_host_mac.cc b/content/browser/plugin_process_host_mac.cc index 6d7bfb5..333cf05 100644 --- a/content/browser/plugin_process_host_mac.cc +++ b/content/browser/plugin_process_host_mac.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -10,9 +10,9 @@ #include "base/logging.h" #include "base/mac/mac_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/plugin_process_host.h" #include "content/common/plugin_messages.h" +#include "content/public/browser/browser_thread.h" #include "ui/gfx/rect.h" void PluginProcessHost::OnPluginSelectWindow(uint32 window_id, diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc index 52ce8550..166ddf9 100644 --- a/content/browser/plugin_service.cc +++ b/content/browser/plugin_service.cc @@ -16,7 +16,6 @@ #include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/browser_thread.h" #include "content/browser/plugin_loader_posix.h" #include "content/browser/plugin_service_filter.h" #include "content/browser/ppapi_plugin_process_host.h" @@ -24,12 +23,13 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/resource_context.h" #include "content/browser/utility_process_host.h" -#include "content/public/browser/notification_service.h" #include "content/common/pepper_plugin_registry.h" #include "content/common/plugin_messages.h" #include "content/common/utility_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/common/content_switches.h" #include "webkit/plugins/npapi/plugin_constants_win.h" diff --git a/content/browser/plugin_service_browsertest.cc b/content/browser/plugin_service_browsertest.cc index 55db351..eb46f9f 100644 --- a/content/browser/plugin_service_browsertest.cc +++ b/content/browser/plugin_service_browsertest.cc @@ -11,9 +11,9 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/browser_thread.h" #include "content/browser/resource_context.h" #include "content/public/common/content_switches.h" +#include "content/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/plugins/npapi/plugin_list.h" diff --git a/content/browser/power_save_blocker_common.cc b/content/browser/power_save_blocker_common.cc index 68c69f2..483d57c 100644 --- a/content/browser/power_save_blocker_common.cc +++ b/content/browser/power_save_blocker_common.cc @@ -5,7 +5,7 @@ #include "content/browser/power_save_blocker.h" #include "base/bind.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" // Accessed only from the UI thread. int PowerSaveBlocker::blocker_count_[kPowerSaveBlockPreventStateCount]; diff --git a/content/browser/power_save_blocker_mac.cc b/content/browser/power_save_blocker_mac.cc index bdcf6f4..4bfcf19 100644 --- a/content/browser/power_save_blocker_mac.cc +++ b/content/browser/power_save_blocker_mac.cc @@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/threading/platform_thread.h" #include "base/threading/thread.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" namespace { diff --git a/content/browser/power_save_blocker_win.cc b/content/browser/power_save_blocker_win.cc index 1a7ce93..1b63735 100644 --- a/content/browser/power_save_blocker_win.cc +++ b/content/browser/power_save_blocker_win.cc @@ -6,7 +6,7 @@ #include <windows.h> -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" // Called only from UI thread. // static diff --git a/content/browser/renderer_host/accelerated_plugin_view_mac.mm b/content/browser/renderer_host/accelerated_plugin_view_mac.mm index 80a8a68..69757c5 100644 --- a/content/browser/renderer_host/accelerated_plugin_view_mac.mm +++ b/content/browser/renderer_host/accelerated_plugin_view_mac.mm @@ -8,8 +8,8 @@ #include "base/command_line.h" #include "base/debug/trace_event.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_widget_host_view_mac.h" +#include "content/public/browser/browser_thread.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_switches.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" diff --git a/content/browser/renderer_host/buffered_resource_handler.cc b/content/browser/renderer_host/buffered_resource_handler.cc index 590f9b32..b4363d92 100644 --- a/content/browser/renderer_host/buffered_resource_handler.cc +++ b/content/browser/renderer_host/buffered_resource_handler.cc @@ -10,7 +10,6 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/string_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/download/download_resource_handler.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" @@ -18,6 +17,7 @@ #include "content/browser/renderer_host/x509_user_cert_resource_handler.h" #include "content/browser/resource_context.h" #include "content/common/resource_response.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/resource_dispatcher_host_delegate.h" #include "net/base/io_buffer.h" diff --git a/content/browser/renderer_host/clipboard_message_filter_mac.mm b/content/browser/renderer_host/clipboard_message_filter_mac.mm index 829a227..b8e7be1 100644 --- a/content/browser/renderer_host/clipboard_message_filter_mac.mm +++ b/content/browser/renderer_host/clipboard_message_filter_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 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. @@ -7,8 +7,8 @@ #import <Cocoa/Cocoa.h> #include "base/sys_string_conversions.h" -#include "content/browser/browser_thread.h" #import "content/browser/find_pasteboard.h" +#include "content/public/browser/browser_thread.h" // The number of utf16 code units that will be written to the find pasteboard, // longer texts are silently ignored. This is to prevent that a compromised diff --git a/content/browser/renderer_host/java_bridge_dispatcher_host.cc b/content/browser/renderer_host/java_bridge_dispatcher_host.cc index 2cc6486..60e33fb 100644 --- a/content/browser/renderer_host/java_bridge_dispatcher_host.cc +++ b/content/browser/renderer_host/java_bridge_dispatcher_host.cc @@ -4,14 +4,14 @@ #include "content/browser/renderer_host/java_bridge_dispatcher_host.h" -#include "content/browser/browser_thread.h" -#include "content/browser/renderer_host/java_bridge_channel_host.h" #include "content/browser/renderer_host/browser_render_process_host.h" +#include "content/browser/renderer_host/java_bridge_channel_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/common/child_process.h" #include "content/common/java_bridge_messages.h" #include "content/common/npobject_stub.h" #include "content/common/npobject_util.h" // For CreateNPVariantParam() +#include "content/public/browser/browser_thread.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" JavaBridgeDispatcherHost::JavaBridgeDispatcherHost( diff --git a/content/browser/renderer_host/media/audio_input_device_manager.cc b/content/browser/renderer_host/media/audio_input_device_manager.cc index 3ff3949..d3d5036 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager.cc @@ -6,8 +6,8 @@ #include "base/bind.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/audio_input_device_manager_event_handler.h" +#include "content/public/browser/browser_thread.h" #include "media/audio/audio_manager.h" namespace media_stream { diff --git a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc index 8892c93..dd6d303 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc @@ -7,9 +7,9 @@ #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/audio_input_device_manager.h" #include "content/browser/renderer_host/media/audio_input_device_manager_event_handler.h" +#include "content/test/test_browser_thread.h" #include "media/audio/audio_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -85,7 +85,8 @@ class AudioInputDeviceManagerTest: public testing::Test { virtual void SetUp() { // The test must run on Browser::IO. message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); - io_thread_.reset(new BrowserThread(BrowserThread::IO, message_loop_.get())); + io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, + message_loop_.get())); manager_.reset(new media_stream::AudioInputDeviceManager()); audio_input_listener_.reset(new MockAudioInputDeviceManagerListener()); manager_->Register(audio_input_listener_.get()); @@ -127,7 +128,7 @@ class AudioInputDeviceManagerTest: public testing::Test { message_loop_->Run(); } scoped_ptr<MessageLoop> message_loop_; - scoped_ptr<BrowserThread> io_thread_; + scoped_ptr<content::TestBrowserThread> io_thread_; scoped_ptr<AudioInputDeviceManager> manager_; scoped_ptr<MockAudioInputDeviceManagerListener> audio_input_listener_; diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.h b/content/browser/renderer_host/media/audio_input_renderer_host.h index e1fb65f..dc3cffe 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host.h +++ b/content/browser/renderer_host/media/audio_input_renderer_host.h @@ -63,8 +63,8 @@ #include "base/process.h" #include "base/shared_memory.h" #include "content/browser/browser_message_filter.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/audio_input_device_manager_event_handler.h" +#include "content/public/browser/browser_thread.h" #include "media/audio/audio_input_controller.h" #include "media/audio/audio_io.h" #include "media/audio/simple_sources.h" diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h index d2308a5..2ec629f 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.h +++ b/content/browser/renderer_host/media/audio_renderer_host.h @@ -61,8 +61,8 @@ #include "base/process.h" #include "base/shared_memory.h" #include "content/browser/browser_message_filter.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "media/audio/audio_io.h" #include "media/audio/audio_output_controller.h" #include "media/audio/simple_sources.h" diff --git a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc index cbf28f1..36b29e2 100644 --- a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc +++ b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc @@ -8,11 +8,11 @@ #include "base/message_loop.h" #include "base/process_util.h" #include "base/sync_socket.h" -#include "content/browser/browser_thread.h" #include "content/browser/mock_resource_context.h" #include "content/browser/renderer_host/media/audio_renderer_host.h" #include "content/browser/renderer_host/media/mock_media_observer.h" #include "content/common/media/audio_messages.h" +#include "content/test/test_browser_thread.h" #include "ipc/ipc_message_utils.h" #include "media/audio/audio_manager.h" #include "media/audio/fake_audio_output_stream.h" @@ -175,8 +175,10 @@ class AudioRendererHostTest : public testing::Test { message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); // Claim to be on both the UI and IO threads to pass all the DCHECKS. - io_thread_.reset(new BrowserThread(BrowserThread::IO, message_loop_.get())); - ui_thread_.reset(new BrowserThread(BrowserThread::UI, message_loop_.get())); + io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, + message_loop_.get())); + ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, + message_loop_.get())); observer_.reset(new MockMediaObserver()); content::MockResourceContext* context = @@ -357,8 +359,8 @@ class AudioRendererHostTest : public testing::Test { scoped_ptr<MockMediaObserver> observer_; scoped_refptr<MockAudioRendererHost> host_; scoped_ptr<MessageLoop> message_loop_; - scoped_ptr<BrowserThread> io_thread_; - scoped_ptr<BrowserThread> ui_thread_; + scoped_ptr<content::TestBrowserThread> io_thread_; + scoped_ptr<content::TestBrowserThread> ui_thread_; DISALLOW_COPY_AND_ASSIGN(AudioRendererHostTest); }; diff --git a/content/browser/renderer_host/media/media_stream_device_settings.cc b/content/browser/renderer_host/media/media_stream_device_settings.cc index 54834e8..3edaf39 100644 --- a/content/browser/renderer_host/media/media_stream_device_settings.cc +++ b/content/browser/renderer_host/media/media_stream_device_settings.cc @@ -6,9 +6,9 @@ #include "base/stl_util.h" #include "base/task.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/media_stream_settings_requester.h" #include "content/common/media/media_stream_options.h" +#include "content/public/browser/browser_thread.h" namespace media_stream { diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index d9f7db7..a9afcee 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc @@ -13,6 +13,7 @@ #include "content/browser/resource_context.h" #include "content/common/media/media_stream_messages.h" #include "content/common/media/media_stream_options.h" +#include "content/test/test_browser_thread.h" #include "ipc/ipc_message_macros.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -141,9 +142,11 @@ class MediaStreamDispatcherHostTest : public testing::Test { virtual void SetUp() { message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); // ResourceContext must be created on UI thread. - ui_thread_.reset(new BrowserThread(BrowserThread::UI, message_loop_.get())); + ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, + message_loop_.get())); // MediaStreamManager must be created and called on IO thread. - io_thread_.reset(new BrowserThread(BrowserThread::IO, message_loop_.get())); + io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, + message_loop_.get())); // Create a MediaStreamManager instance and hand over pointer to // ResourceContext. @@ -193,8 +196,8 @@ class MediaStreamDispatcherHostTest : public testing::Test { scoped_refptr<MockMediaStreamDispatcherHost> host_; scoped_ptr<MessageLoop> message_loop_; - scoped_ptr<BrowserThread> ui_thread_; - scoped_ptr<BrowserThread> io_thread_; + scoped_ptr<content::TestBrowserThread> ui_thread_; + scoped_ptr<content::TestBrowserThread> io_thread_; scoped_ptr<MediaStreamManager> media_stream_manager_; }; diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index ce216b4..8c0a1130 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc @@ -9,12 +9,12 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/rand_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/audio_input_device_manager.h" #include "content/browser/renderer_host/media/media_stream_device_settings.h" #include "content/browser/renderer_host/media/media_stream_requester.h" #include "content/browser/renderer_host/media/video_capture_manager.h" #include "content/common/media/media_stream_options.h" +#include "content/public/browser/browser_thread.h" namespace media_stream { diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc index f30f2d5..286f7b4 100644 --- a/content/browser/renderer_host/media/video_capture_controller.cc +++ b/content/browser/renderer_host/media/video_capture_controller.cc @@ -6,9 +6,9 @@ #include "base/bind.h" #include "base/stl_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/media_stream_manager.h" #include "content/browser/renderer_host/media/video_capture_manager.h" +#include "content/public/browser/browser_thread.h" #include "media/base/yuv_convert.h" // The number of TransportDIBs VideoCaptureController allocate. diff --git a/content/browser/renderer_host/media/video_capture_host_unittest.cc b/content/browser/renderer_host/media/video_capture_host_unittest.cc index cd8ac06..3bf4de0 100644 --- a/content/browser/renderer_host/media/video_capture_host_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_host_unittest.cc @@ -12,13 +12,13 @@ #include "base/process_util.h" #include "base/stl_util.h" #include "base/stringprintf.h" -#include "content/browser/browser_thread.h" #include "content/browser/mock_resource_context.h" #include "content/browser/renderer_host/media/media_stream_manager.h" #include "content/browser/renderer_host/media/video_capture_host.h" #include "content/browser/renderer_host/media/video_capture_manager.h" #include "content/browser/resource_context.h" #include "content/common/media/video_capture_messages.h" +#include "content/test/test_browser_thread.h" #include "media/video/capture/video_capture_types.h" #include "testing/gmock/include/gmock/gmock.h" @@ -195,10 +195,12 @@ class VideoCaptureHostTest : public testing::Test { message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); // ResourceContext must be created on the UI thread. - ui_thread_.reset(new BrowserThread(BrowserThread::UI, message_loop_.get())); + ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, + message_loop_.get())); // MediaStreamManager must be created on the IO thread. - io_thread_.reset(new BrowserThread(BrowserThread::IO, message_loop_.get())); + io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, + message_loop_.get())); // Create a MediaStreamManager instance and hand over pointer to // ResourceContext. @@ -360,8 +362,8 @@ class VideoCaptureHostTest : public testing::Test { private: scoped_ptr<MessageLoop> message_loop_; - scoped_ptr<BrowserThread> ui_thread_; - scoped_ptr<BrowserThread> io_thread_; + scoped_ptr<content::TestBrowserThread> ui_thread_; + scoped_ptr<content::TestBrowserThread> io_thread_; scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; DISALLOW_COPY_AND_ASSIGN(VideoCaptureHostTest); diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc index 2143c91..3a7e87f 100644 --- a/content/browser/renderer_host/media/video_capture_manager.cc +++ b/content/browser/renderer_host/media/video_capture_manager.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" #include "media/video/capture/fake_video_capture_device.h" #include "media/video/capture/video_capture_device.h" diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc index e6ae7b2..1ec4991 100644 --- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc @@ -10,10 +10,10 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/process_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/media/media_stream_provider.h" #include "content/browser/renderer_host/media/video_capture_manager.h" #include "content/common/media/media_stream_options.h" +#include "content/test/test_browser_thread.h" #include "media/video/capture/video_capture_device.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -82,7 +82,8 @@ class VideoCaptureManagerTest : public testing::Test { virtual void SetUp() { listener_.reset(new media_stream::MockMediaStreamProviderListener()); message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); - io_thread_.reset(new BrowserThread(BrowserThread::IO, message_loop_.get())); + io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, + message_loop_.get())); vcm_.reset(new media_stream::VideoCaptureManager()); vcm_->UseFakeDevice(); vcm_->Register(listener_.get()); @@ -120,7 +121,7 @@ class VideoCaptureManagerTest : public testing::Test { scoped_ptr<media_stream::VideoCaptureManager> vcm_; scoped_ptr<media_stream::MockMediaStreamProviderListener> listener_; scoped_ptr<MessageLoop> message_loop_; - scoped_ptr<BrowserThread> io_thread_; + scoped_ptr<content::TestBrowserThread> io_thread_; scoped_ptr<MockFrameObserver> frame_observer_; private: diff --git a/content/browser/renderer_host/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper_file_message_filter.cc index 3b37cfc..b288975 100644 --- a/content/browser/renderer_host/pepper_file_message_filter.cc +++ b/content/browser/renderer_host/pepper_file_message_filter.cc @@ -10,10 +10,10 @@ #include "base/platform_file.h" #include "base/process_util.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/renderer_host/browser_render_process_host.h" #include "content/common/pepper_file_messages.h" +#include "content/public/browser/browser_thread.h" #include "ipc/ipc_platform_file.h" #include "webkit/plugins/ppapi/file_path.h" diff --git a/content/browser/renderer_host/pepper_message_filter.cc b/content/browser/renderer_host/pepper_message_filter.cc index 3cc90ce..434a6d8 100644 --- a/content/browser/renderer_host/pepper_message_filter.cc +++ b/content/browser/renderer_host/pepper_message_filter.cc @@ -19,17 +19,17 @@ #include "base/process_util.h" #include "base/threading/worker_pool.h" #include "base/values.h" -#include "content/browser/browser_thread.h" #include "content/browser/font_list_async.h" #include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/resource_context.h" #include "content/common/pepper_messages.h" +#include "content/public/browser/browser_thread.h" #include "net/base/address_list.h" #include "net/base/cert_verifier.h" -#include "net/base/ip_endpoint.h" #include "net/base/host_port_pair.h" #include "net/base/host_resolver.h" #include "net/base/io_buffer.h" +#include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" #include "net/base/single_request_host_resolver.h" #include "net/base/ssl_config_service.h" diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 0ee35cd..9222836 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -14,7 +14,6 @@ #include "base/threading/worker_pool.h" #include "base/utf_string_conversions.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/download/download_stats.h" #include "content/browser/download/download_types.h" @@ -32,6 +31,7 @@ #include "content/common/child_process_messages.h" #include "content/common/desktop_notification_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" diff --git a/content/browser/renderer_host/render_process_host.cc b/content/browser/renderer_host/render_process_host.cc index d9ce96b..251f3bb 100644 --- a/content/browser/renderer_host/render_process_host.cc +++ b/content/browser/renderer_host/render_process_host.cc @@ -8,11 +8,11 @@ #include "base/rand_util.h" #include "base/sys_info.h" #include "content/browser/browser_main.h" -#include "content/browser/browser_thread.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/webui/web_ui_factory.h" #include "content/common/child_process_info.h" #include "content/common/content_constants.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" diff --git a/content/browser/renderer_host/render_view_host_notification_task.h b/content/browser/renderer_host/render_view_host_notification_task.h index d30c28b..c14f476 100644 --- a/content/browser/renderer_host/render_view_host_notification_task.h +++ b/content/browser/renderer_host/render_view_host_notification_task.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 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. @@ -13,9 +13,9 @@ #include "base/callback_old.h" #include "base/task.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" +#include "content/public/browser/browser_thread.h" // ---------------------------------------------------------------------------- diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc index cbfa094..18a95e6 100644 --- a/content/browser/renderer_host/render_widget_helper.cc +++ b/content/browser/renderer_host/render_widget_helper.cc @@ -6,11 +6,11 @@ #include "base/eintr_wrapper.h" #include "base/threading/thread.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" // A Task used with InvokeLater that we hold a pointer to in pending_paints_. // Instances are deleted by MessageLoop after it calls their Run method. diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 047e620..c5a5769 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -6,17 +6,17 @@ #include "base/memory/scoped_ptr.h" #include "base/shared_memory.h" #include "base/timer.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/common/view_messages.h" +#include "content/public/browser/content_browser_client.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" -#include "content/public/browser/content_browser_client.h" #include "content/test/test_browser_context.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/gfx/canvas_skia.h" @@ -527,7 +527,8 @@ TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) { // Test that we don't paint when we're hidden, but we still send the ACK. Most // of the rest of the painting is tested in the GetBackingStore* ones. TEST_F(RenderWidgetHostTest, HiddenPaint) { - BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); + content::TestBrowserThread ui_thread(BrowserThread::UI, + MessageLoop::current()); // Hide the widget, it should have sent out a message to the renderer. EXPECT_FALSE(host_->is_hidden_); host_->WasHidden(); diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 56f0c88..ed0ebac 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -11,14 +11,13 @@ #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #import "base/mac/scoped_nsautorelease_pool.h" -#include "base/metrics/histogram.h" #import "base/memory/scoped_nsobject.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/sys_info.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" #import "content/browser/accessibility/browser_accessibility_cocoa.h" -#include "content/browser/browser_thread.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/mac/closure_blocks_leopard_compat.h" @@ -34,14 +33,15 @@ #include "content/common/gpu/gpu_messages.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/native_web_keyboard_event.h" #include "skia/ext/platform_canvas.h" -#import "third_party/mozilla/ComplexTextInputPanel.h" -#include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFactory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h" +#import "third_party/mozilla/ComplexTextInputPanel.h" +#include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/point.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" #include "ui/gfx/surface/io_surface_support_mac.h" diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index c09939f..c6744fb 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm @@ -5,8 +5,8 @@ #include "content/browser/renderer_host/render_widget_host_view_mac.h" #include "base/mac/scoped_nsautorelease_pool.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/test_render_view_host.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/test/cocoa_test_event_utils.h" #import "ui/base/test/ui_cocoa_test_helper.h" @@ -88,8 +88,9 @@ TEST_F(RenderWidgetHostViewMacTest, Basic) { // Regression test for http://crbug.com/60318 TEST_F(RenderWidgetHostViewMacTest, FocusAcceleratedView) { // The accelerated view methods want to be called on the UI thread. - scoped_ptr<BrowserThread> ui_thread_( - new BrowserThread(BrowserThread::UI, MessageLoop::current())); + scoped_ptr<content::TestBrowserThread> ui_thread_( + new content::TestBrowserThread(BrowserThread::UI, + MessageLoop::current())); int w = 400, h = 300; gfx::PluginWindowHandle accelerated_handle = AddAcceleratedPluginView(w, h); @@ -160,8 +161,9 @@ TEST_F(RenderWidgetHostViewMacTest, TakesFocusOnMouseDown) { // Regression test for http://crbug.com/64256 TEST_F(RenderWidgetHostViewMacTest, TakesFocusOnMouseDownWithAcceleratedView) { // The accelerated view methods want to be called on the UI thread. - scoped_ptr<BrowserThread> ui_thread_( - new BrowserThread(BrowserThread::UI, MessageLoop::current())); + scoped_ptr<content::TestBrowserThread> ui_thread_( + new content::TestBrowserThread(BrowserThread::UI, + MessageLoop::current())); int w = 400, h = 300; gfx::PluginWindowHandle accelerated_handle = AddAcceleratedPluginView(w, h); diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 340daad..6a7bf48 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -19,7 +19,6 @@ #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/browser_accessibility_state.h" #include "content/browser/accessibility/browser_accessibility_win.h" -#include "content/browser/browser_thread.h" #include "content/browser/plugin_process_host.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/backing_store_win.h" @@ -27,6 +26,7 @@ #include "content/browser/renderer_host/render_widget_host.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/notification_service.h" diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc index 1b57703..919674f 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -10,7 +10,6 @@ #include "base/file_path.h" #include "base/message_loop.h" #include "base/process_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/download/download_id.h" #include "content/browser/mock_resource_context.h" @@ -23,6 +22,7 @@ #include "content/common/resource_messages.h" #include "content/common/resource_response.h" #include "content/common/view_messages.h" +#include "content/test/test_browser_thread.h" #include "net/base/net_errors.h" #include "net/base/upload_data.h" #include "net/http/http_util.h" @@ -385,8 +385,8 @@ class ResourceDispatcherHostTest : public testing::Test, } MessageLoopForIO message_loop_; - BrowserThread ui_thread_; - BrowserThread io_thread_; + content::TestBrowserThread ui_thread_; + content::TestBrowserThread io_thread_; scoped_refptr<ForwardingFilter> filter_; ResourceDispatcherHost host_; ResourceIPCAccumulator accum_; diff --git a/content/browser/renderer_host/resource_handler.h b/content/browser/renderer_host/resource_handler.h index 838f887..7fca15a 100644 --- a/content/browser/renderer_host/resource_handler.h +++ b/content/browser/renderer_host/resource_handler.h @@ -15,7 +15,7 @@ #include <string> -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" namespace net { class IOBuffer; diff --git a/content/browser/renderer_host/resource_message_filter.cc b/content/browser/renderer_host/resource_message_filter.cc index 889a1c0..ba5b7c4 100644 --- a/content/browser/renderer_host/resource_message_filter.cc +++ b/content/browser/renderer_host/resource_message_filter.cc @@ -4,9 +4,9 @@ #include "content/browser/renderer_host/resource_message_filter.h" -#include "content/browser/browser_thread.h" -#include "content/browser/resource_context.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" +#include "content/browser/resource_context.h" +#include "content/public/browser/browser_thread.h" ResourceMessageFilter::ResourceMessageFilter( int child_id, diff --git a/content/browser/renderer_host/resource_queue.cc b/content/browser/renderer_host/resource_queue.cc index 681c8ac..8821425 100644 --- a/content/browser/renderer_host/resource_queue.cc +++ b/content/browser/renderer_host/resource_queue.cc @@ -5,9 +5,9 @@ #include "content/browser/renderer_host/resource_queue.h" #include "base/stl_util.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/global_request_id.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" +#include "content/public/browser/browser_thread.h" ResourceQueueDelegate::~ResourceQueueDelegate() { } diff --git a/content/browser/renderer_host/resource_queue_unittest.cc b/content/browser/renderer_host/resource_queue_unittest.cc index c743573..cc48914 100644 --- a/content/browser/renderer_host/resource_queue_unittest.cc +++ b/content/browser/renderer_host/resource_queue_unittest.cc @@ -4,12 +4,12 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" -#include "content/browser/browser_thread.h" #include "content/browser/mock_resource_context.h" #include "content/browser/renderer_host/dummy_resource_handler.h" #include "content/browser/renderer_host/global_request_id.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/renderer_host/resource_queue.h" +#include "content/test/test_browser_thread.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request.h" #include "testing/gtest/include/gtest/gtest.h" @@ -123,8 +123,8 @@ class ResourceQueueTest : public testing::Test, private: MessageLoop message_loop_; - BrowserThread ui_thread_; - BrowserThread io_thread_; + content::TestBrowserThread ui_thread_; + content::TestBrowserThread io_thread_; }; TEST_F(ResourceQueueTest, Basic) { diff --git a/content/browser/renderer_host/text_input_client_message_filter.mm b/content/browser/renderer_host/text_input_client_message_filter.mm index 927a714..44824cb 100644 --- a/content/browser/renderer_host/text_input_client_message_filter.mm +++ b/content/browser/renderer_host/text_input_client_message_filter.mm @@ -6,11 +6,11 @@ #include "base/memory/scoped_nsobject.h" #include "base/string16.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/renderer_host/text_input_client_mac.h" #include "content/common/text_input_client_messages.h" +#include "content/public/browser/browser_thread.h" #include "ipc/ipc_message_macros.h" #include "ui/base/range/range.h" #include "ui/gfx/rect.h" diff --git a/content/browser/resolve_proxy_msg_helper_unittest.cc b/content/browser/resolve_proxy_msg_helper_unittest.cc index 91f35c1..b700f58 100644 --- a/content/browser/resolve_proxy_msg_helper_unittest.cc +++ b/content/browser/resolve_proxy_msg_helper_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/resolve_proxy_msg_helper.h" #include "content/common/view_messages.h" +#include "content/test/test_browser_thread.h" #include "ipc/ipc_test_sink.h" #include "net/base/net_errors.h" #include "net/proxy/mock_proxy_resolver.h" @@ -77,7 +78,7 @@ class ResolveProxyMsgHelperTest : public testing::Test, } MessageLoop message_loop_; - BrowserThread io_thread_; + content::TestBrowserThread io_thread_; IPC::TestSink test_sink_; }; diff --git a/content/browser/resource_context.cc b/content/browser/resource_context.cc index 552ed1e..d59f6b1 100644 --- a/content/browser/resource_context.cc +++ b/content/browser/resource_context.cc @@ -5,8 +5,8 @@ #include "content/browser/resource_context.h" #include "base/logging.h" -#include "content/browser/browser_thread.h" #include "content/browser/plugin_process_host.h" +#include "content/public/browser/browser_thread.h" #include "webkit/database/database_tracker.h" namespace content { diff --git a/content/browser/site_instance_unittest.cc b/content/browser/site_instance_unittest.cc index 50cc712..d19ef68 100644 --- a/content/browser/site_instance_unittest.cc +++ b/content/browser/site_instance_unittest.cc @@ -5,7 +5,6 @@ #include "base/compiler_specific.h" #include "base/stl_util.h" #include "base/string16.h" -#include "content/browser/browser_thread.h" #include "content/browser/browsing_instance.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/mock_content_browser_client.h" @@ -20,6 +19,7 @@ #include "content/public/common/content_client.h" #include "content/public/common/url_constants.h" #include "content/test/test_browser_context.h" +#include "content/test/test_browser_thread.h" #include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -115,7 +115,7 @@ class SiteInstanceTest : public testing::Test { private: MessageLoopForUI message_loop_; - BrowserThread ui_thread_; + content::TestBrowserThread ui_thread_; SiteInstanceTestBrowserClient browser_client_; content::ContentBrowserClient* old_browser_client_; diff --git a/content/browser/speech/speech_input_manager.cc b/content/browser/speech/speech_input_manager.cc index ac1037b..2019b6e 100644 --- a/content/browser/speech/speech_input_manager.cc +++ b/content/browser/speech/speech_input_manager.cc @@ -5,8 +5,8 @@ #include "content/browser/speech/speech_input_manager.h" #include "base/bind.h" -#include "content/browser/browser_thread.h" #include "content/browser/speech/speech_input_preferences.h" +#include "content/public/browser/browser_thread.h" #include "media/audio/audio_manager.h" namespace speech_input { diff --git a/content/browser/speech/speech_recognizer.cc b/content/browser/speech/speech_recognizer.cc index f045e6f..4ee9421 100644 --- a/content/browser/speech/speech_recognizer.cc +++ b/content/browser/speech/speech_recognizer.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/time.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" #include "net/url_request/url_request_context_getter.h" using media::AudioInputController; diff --git a/content/browser/speech/speech_recognizer_unittest.cc b/content/browser/speech/speech_recognizer_unittest.cc index 9b1bbc2..9ffb08b 100644 --- a/content/browser/speech/speech_recognizer_unittest.cc +++ b/content/browser/speech/speech_recognizer_unittest.cc @@ -4,8 +4,8 @@ #include <vector> -#include "content/browser/browser_thread.h" #include "content/browser/speech/speech_recognizer.h" +#include "content/test/test_browser_thread.h" #include "content/test/test_url_fetcher_factory.h" #include "media/audio/test_audio_input_controller_factory.h" #include "net/base/net_errors.h" @@ -106,7 +106,7 @@ class SpeechRecognizerTest : public SpeechRecognizerDelegate, protected: MessageLoopForIO message_loop_; - BrowserThread io_thread_; + content::TestBrowserThread io_thread_; scoped_refptr<SpeechRecognizer> recognizer_; bool recording_complete_; bool recognition_complete_; diff --git a/content/browser/ssl/ssl_client_auth_handler.cc b/content/browser/ssl/ssl_client_auth_handler.cc index 74e52c5..f78636e 100644 --- a/content/browser/ssl/ssl_client_auth_handler.cc +++ b/content/browser/ssl/ssl_client_auth_handler.cc @@ -5,10 +5,10 @@ #include "content/browser/ssl/ssl_client_auth_handler.h" #include "base/bind.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/ssl/ssl_client_auth_notification_details.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/notification_service.h" #include "net/base/x509_certificate.h" diff --git a/content/browser/ssl/ssl_client_auth_handler.h b/content/browser/ssl/ssl_client_auth_handler.h index f5a0997..019ffaf 100644 --- a/content/browser/ssl/ssl_client_auth_handler.h +++ b/content/browser/ssl/ssl_client_auth_handler.h @@ -8,8 +8,8 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "net/base/ssl_cert_request_info.h" diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc index 8771996..8fb462a 100644 --- a/content/browser/ssl/ssl_error_handler.cc +++ b/content/browser/ssl/ssl_error_handler.cc @@ -5,13 +5,13 @@ #include "content/browser/ssl/ssl_error_handler.h" #include "base/bind.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/ssl/ssl_cert_error_handler.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "net/base/net_errors.h" #include "net/url_request/url_request.h" diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index f4abf54..17f2239 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/load_from_memory_cache_details.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" @@ -18,6 +17,7 @@ #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/provisional_load_details.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "net/base/cert_status_flags.h" diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 3a8568b..8da9525 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -11,7 +11,6 @@ #include "base/string_util.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" @@ -22,9 +21,10 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/common/dom_storage_common.h" -#include "content/public/browser/notification_service.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/page_transition_types.h" diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc index a22b800..4dc9cf8 100644 --- a/content/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc @@ -4,7 +4,6 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/browser_thread.h" #include "content/browser/browser_url_handler.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/navigation_controller.h" @@ -17,6 +16,8 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/common/page_transition_types.h" +#include "content/test/test_browser_thread.h" +#include "content/test/test_browser_thread.h" #include "content/test/test_notification_tracker.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/webkit_glue.h" @@ -60,7 +61,8 @@ class RenderViewHostManagerTest : public ChromeRenderViewHostTestHarness { // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is // a regression test for bug 9364. TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { - BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); + content::TestBrowserThread ui_thread(BrowserThread::UI, + MessageLoop::current()); const GURL kNtpUrl(chrome::kTestNewTabURL); const GURL kDestUrl("http://www.google.com/"); @@ -119,7 +121,8 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { // EnableViewSourceMode message is sent on every navigation regardless // RenderView is being newly created or reused. TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { - BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); + content::TestBrowserThread ui_thread(BrowserThread::UI, + MessageLoop::current()); const GURL kNtpUrl(chrome::kTestNewTabURL); const GURL kUrl("view-source:http://foo"); @@ -271,7 +274,8 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // Tests WebUI creation. TEST_F(RenderViewHostManagerTest, WebUI) { - BrowserThread ui_thread(BrowserThread::UI, MessageLoop::current()); + content::TestBrowserThread ui_thread(BrowserThread::UI, + MessageLoop::current()); SiteInstance* instance = SiteInstance::CreateSiteInstance(profile()); TestTabContents tab_contents(profile(), instance); @@ -311,7 +315,7 @@ TEST_F(RenderViewHostManagerTest, WebUI) { // still swap processes if ShouldSwapProcessesForNavigation is true. // Regression test for bug 46290. TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) { - BrowserThread thread(BrowserThread::UI, &message_loop_); + content::TestBrowserThread thread(BrowserThread::UI, &message_loop_); SiteInstance* instance = SiteInstance::CreateSiteInstance(profile()); TestTabContents tab_contents(profile(), instance); RenderViewHostManager manager(&tab_contents, &tab_contents); diff --git a/content/browser/tab_contents/web_drag_source_mac.mm b/content/browser/tab_contents/web_drag_source_mac.mm index 04c17d8..35d0d6f 100644 --- a/content/browser/tab_contents/web_drag_source_mac.mm +++ b/content/browser/tab_contents/web_drag_source_mac.mm @@ -13,7 +13,7 @@ #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "base/utf_string_conversions.h" -#include "content/browser/browser_thread.h" +#include "content/browser/browser_thread_impl.h" #include "content/browser/download/drag_download_file.h" #include "content/browser/download/drag_download_util.h" #include "content/browser/renderer_host/render_view_host.h" diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc index d58c666..8191418 100644 --- a/content/browser/user_metrics.cc +++ b/content/browser/user_metrics.cc @@ -4,7 +4,7 @@ #include "content/browser/user_metrics.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" diff --git a/content/browser/utility_process_host.h b/content/browser/utility_process_host.h index 52f4fff..23d749a 100644 --- a/content/browser/utility_process_host.h +++ b/content/browser/utility_process_host.h @@ -13,8 +13,8 @@ #include "base/memory/ref_counted.h" #include "base/process_util.h" #include "content/browser/browser_child_process_host.h" -#include "content/browser/browser_thread.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_thread.h" // This class acts as the browser-side host to a utility child process. A // utility process is a short-lived sandboxed process that is created to run diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index 228cd7b..2eabbeb 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -16,7 +16,6 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "content/browser/appcache/appcache_dispatcher_host.h" -#include "content/browser/browser_thread.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/debugger/worker_devtools_message_filter.h" #include "content/browser/file_system/file_system_dispatcher_host.h" @@ -35,11 +34,12 @@ #include "content/common/debug_flags.h" #include "content/common/view_messages.h" #include "content/common/worker_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" -#include "net/base/mime_util.h" #include "ipc/ipc_switches.h" +#include "net/base/mime_util.h" #include "net/base/registry_controlled_domain.h" #include "ui/base/ui_base_switches.h" #include "webkit/fileapi/file_system_context.h" diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 9d3f8e4..f6667c3 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -59,8 +59,8 @@ 'browser/browser_message_filter.h', 'browser/browser_process_sub_thread.cc', 'browser/browser_process_sub_thread.h', - 'browser/browser_thread.cc', - 'browser/browser_thread.h', + 'browser/browser_thread_impl.cc', + 'browser/browser_thread_impl.h', 'browser/browser_url_handler.cc', 'browser/browser_url_handler.h', 'browser/browsing_instance.cc', @@ -576,6 +576,7 @@ 'browser/zygote_host_linux.h', 'browser/zygote_main_linux.cc', 'public/browser/browser_main_parts.h', + 'public/browser/browser_thread.h', 'public/browser/content_browser_client.h', 'public/browser/download_manager_delegate.h', 'public/browser/native_web_keyboard_event.h', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index c8fb0eb..d0238e4 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -75,6 +75,8 @@ 'test/render_view_test.h', 'test/test_browser_context.cc', 'test/test_browser_context.h', + 'test/test_browser_thread.cc', + 'test/test_browser_thread.h', 'test/test_content_client.cc', 'test/test_content_client.h', 'test/test_notification_tracker.cc', diff --git a/content/browser/browser_thread.h b/content/public/browser/browser_thread.h index 2e79897..7515939 100644 --- a/content/browser/browser_thread.h +++ b/content/public/browser/browser_thread.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_BROWSER_THREAD_H_ -#define CONTENT_BROWSER_BROWSER_THREAD_H_ +#ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ +#define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ #pragma once #include "base/callback.h" @@ -20,12 +20,20 @@ namespace base { class MessageLoopProxy; } +namespace content { +class BrowserThreadImpl; +} + +class DeprecatedBrowserThread; + /////////////////////////////////////////////////////////////////////////////// // BrowserThread // -// This class represents a thread that is known by a browser-wide name. For -// example, there is one IO thread for the entire browser process, and various -// pieces of code find it useful to retrieve a pointer to the IO thread's +// Utility functions for threads that are known by a browser-wide +// name. For example, there is one IO thread for the entire browser +// process, and various pieces of code find it useful to retrieve a +// pointer to the IO thread's message loop. +// // Invoke a task by thread ID: // // BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task); @@ -81,16 +89,6 @@ class CONTENT_EXPORT BrowserThread : public base::Thread { ID_COUNT }; - // Construct a BrowserThread with the supplied identifier. It is an error - // to construct a BrowserThread that already exists. - explicit BrowserThread(ID identifier); - - // Special constructor for the main (UI) thread and unittests. We use a dummy - // thread here since the main thread already exists. - BrowserThread(ID identifier, MessageLoop* message_loop); - - virtual ~BrowserThread(); - // These are the same methods in message_loop.h, but are guaranteed to either // get posted to the MessageLoop if it's still alive, or be deleted otherwise. // They return true iff the thread existed and the task was posted. Note that @@ -216,36 +214,40 @@ class CONTENT_EXPORT BrowserThread : public base::Thread { struct DeleteOnWebKitThread : public DeleteOnThread<WEBKIT> { }; private: + // Construct a BrowserThread with the supplied identifier. It is an error + // to construct a BrowserThread that already exists. + explicit BrowserThread(ID identifier); + + // Special constructor for the main (UI) thread and unittests. We use a dummy + // thread here since the main thread already exists. + BrowserThread(ID identifier, MessageLoop* message_loop); + + virtual ~BrowserThread(); + // Common initialization code for the constructors. void Initialize(); - // TODO(brettw) remove this variant when Task->Closure migration is complete. - static bool PostTaskHelper( - ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms, - bool nestable); - static bool PostTaskHelper( - ID identifier, - const tracked_objects::Location& from_here, - const base::Closure& task, - int64 delay_ms, - bool nestable); + // Constructors are only available through this subclass. + friend class content::BrowserThreadImpl; + + // TODO(joi): Remove. + friend class DeprecatedBrowserThread; // The identifier of this thread. Only one thread can exist with a given // identifier at a given time. + // TODO(joi): Move to BrowserThreadImpl, and make constructors here + // do-nothing. ID identifier_; +}; - // This lock protects |browser_threads_|. Do not read or modify that array - // without holding this lock. Do not block while holding this lock. - static base::Lock lock_; - - // An array of the BrowserThread objects. This array is protected by |lock_|. - // The threads are not owned by this array. Typically, the threads are owned - // on the UI thread by the g_browser_process object. BrowserThreads remove - // themselves from this array upon destruction. - static BrowserThread* browser_threads_[ID_COUNT]; +// Temporary escape hatch for chrome/ to construct BrowserThread, +// until we make content/ construct its own threads. +class DeprecatedBrowserThread : public BrowserThread { + public: + explicit DeprecatedBrowserThread(BrowserThread::ID identifier); + DeprecatedBrowserThread(BrowserThread::ID identifier, + MessageLoop* message_loop); + virtual ~DeprecatedBrowserThread(); }; -#endif // CONTENT_BROWSER_BROWSER_THREAD_H_ +#endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 561382e..94ab2f1 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/path_service.h" #include "content/browser/appcache/chrome_appcache_service.h" -#include "content/browser/browser_thread.h" #include "content/browser/chrome_blob_storage_context.h" #include "content/browser/download/download_manager.h" #include "content/browser/download/download_status_updater.h" @@ -16,8 +15,9 @@ #include "content/browser/geolocation/geolocation_permission_context.h" #include "content/browser/host_zoom_map.h" #include "content/browser/in_process_webkit/webkit_context.h" -#include "content/browser/ssl/ssl_host_state.h" #include "content/browser/speech/speech_input_preferences.h" +#include "content/browser/ssl/ssl_host_state.h" +#include "content/public/browser/browser_thread.h" #include "content/shell/shell_browser_main.h" #include "content/shell/shell_download_manager_delegate.h" #include "content/shell/shell_resource_context.h" diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index 3b14c89..1d6ec99 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -15,10 +15,10 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "content/browser/browser_context.h" -#include "content/browser/browser_thread.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/download/download_manager.h" #include "content/browser/download/download_state_info.h" +#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/browser_thread.h" #include "net/base/net_util.h" namespace content { diff --git a/content/shell/shell_url_request_context_getter.cc b/content/shell/shell_url_request_context_getter.cc index a6ba692..52c6683 100644 --- a/content/shell/shell_url_request_context_getter.cc +++ b/content/shell/shell_url_request_context_getter.cc @@ -6,17 +6,17 @@ #include "base/logging.h" #include "base/string_split.h" -#include "content/browser/browser_thread.h" +#include "content/public/browser/browser_thread.h" #include "net/base/cert_verifier.h" #include "net/base/cookie_monster.h" #include "net/base/default_origin_bound_cert_store.h" #include "net/base/dnsrr_resolver.h" #include "net/base/host_resolver.h" -#include "net/http/http_auth_handler_factory.h" -#include "net/http/http_server_properties_impl.h" -#include "net/http/http_cache.h" #include "net/base/origin_bound_cert_service.h" #include "net/base/ssl_config_service_defaults.h" +#include "net/http/http_auth_handler_factory.h" +#include "net/http/http_cache.h" +#include "net/http/http_server_properties_impl.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_storage.h" diff --git a/content/test/test_browser_thread.cc b/content/test/test_browser_thread.cc new file mode 100644 index 0000000..002a93f --- /dev/null +++ b/content/test/test_browser_thread.cc @@ -0,0 +1,20 @@ +// 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. + +#include "content/test/test_browser_thread.h" + +namespace content { + +TestBrowserThread::TestBrowserThread(ID identifier) + : BrowserThreadImpl(identifier) { +} + +TestBrowserThread::TestBrowserThread(ID identifier, MessageLoop* message_loop) + : BrowserThreadImpl(identifier, message_loop) { +} + +TestBrowserThread::~TestBrowserThread() { +} + +} // namespace content diff --git a/content/test/test_browser_thread.h b/content/test/test_browser_thread.h new file mode 100644 index 0000000..1067f9e --- /dev/null +++ b/content/test/test_browser_thread.h @@ -0,0 +1,24 @@ +// 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. + +#ifndef CONTENT_TEST_TEST_BROWSER_BROWSER_THREAD_H_ +#define CONTENT_TEST_TEST_BROWSER_BROWSER_THREAD_H_ +#pragma once + +#include "content/browser/browser_thread_impl.h" + +namespace content { + +// A BrowserThread for unit tests; this lets unit tests in chrome/ +// create BrowserThread instances. +class TestBrowserThread : public BrowserThreadImpl { + public: + explicit TestBrowserThread(ID identifier); + TestBrowserThread(ID identifier, MessageLoop* message_loop); + virtual ~TestBrowserThread(); +}; + +} // namespace content + +#endif // CONTENT_TEST_TEST_BROWSER_BROWSER_THREAD_H_ diff --git a/content/test/test_url_fetcher_factory.h b/content/test/test_url_fetcher_factory.h index fc1bfdb..3b64324 100644 --- a/content/test/test_url_fetcher_factory.h +++ b/content/test/test_url_fetcher_factory.h @@ -38,7 +38,7 @@ class ScopedURLFetcherFactory : public base::NonThreadSafe { // // TestURLFetcher requires a MessageLoop: // MessageLoopForUI message_loop; // // And io_thread to release URLRequestContextGetter in URLFetcher::Core. -// BrowserThread io_thread(BrowserThread::IO, &message_loop); +// BrowserThreadImpl io_thread(BrowserThread::IO, &message_loop); // // Create factory (it automatically sets itself as URLFetcher's factory). // TestURLFetcherFactory factory; // // Do something that triggers creation of a URLFetcher. |