diff options
author | jam <jam@chromium.org> | 2015-02-03 10:16:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-03 18:16:56 +0000 |
commit | 8a021512a24f87d3b1723f260e0380b874f3b9eb (patch) | |
tree | fe0fd8bea7c18d5b6d6f28338d150db187512866 /content | |
parent | 4adea21c6771ac1aaa6260524c3c283e85415672 (diff) | |
download | chromium_src-8a021512a24f87d3b1723f260e0380b874f3b9eb.zip chromium_src-8a021512a24f87d3b1723f260e0380b874f3b9eb.tar.gz chromium_src-8a021512a24f87d3b1723f260e0380b874f3b9eb.tar.bz2 |
Unify the three places that patch font loading for PDFium on Windows.
This also removed the code from content, which doesn't belong there because it's for a feature in Chrome.
In order to implement this in a unified way, I needed to create a public interface around ChildThread. A lot of the change is updating callers of ChildThread to use ChildThreadImpl instead.
BUG=448473
Review URL: https://codereview.chromium.org/897563002
Cr-Commit-Position: refs/heads/master@{#314367}
Diffstat (limited to 'content')
64 files changed, 330 insertions, 354 deletions
diff --git a/content/app/android/child_process_service.cc b/content/app/android/child_process_service.cc index 9d46e08..93c622e 100644 --- a/content/app/android/child_process_service.cc +++ b/content/app/android/child_process_service.cc @@ -12,7 +12,7 @@ #include "base/android/memory_pressure_listener_android.h" #include "base/logging.h" #include "base/posix/global_descriptors.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/android/surface_texture_manager.h" #include "content/common/android/surface_texture_peer.h" #include "content/common/gpu/gpu_surface_lookup.h" @@ -188,7 +188,7 @@ bool RegisterChildProcessService(JNIEnv* env) { } void ShutdownMainThread(JNIEnv* env, jobject obj) { - ChildThread::ShutdownThread(); + ChildThreadImpl::ShutdownThread(); } } // namespace content diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index d5b5367..a8d488a 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -31,7 +31,7 @@ #include "content/app/resources/grit/content_resources.h" #include "content/app/strings/grit/content_strings.h" #include "content/child/bluetooth/web_bluetooth_impl.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/content_child_helpers.h" #include "content/child/geofencing/web_geofencing_provider_impl.h" #include "content/child/navigator_connect/navigator_connect_provider.h" @@ -436,15 +436,15 @@ BlinkPlatformImpl::BlinkPlatformImpl( void BlinkPlatformImpl::InternalInit() { // ChildThread may not exist in some tests. - if (ChildThread::current()) { + if (ChildThreadImpl::current()) { geofencing_provider_.reset(new WebGeofencingProviderImpl( - ChildThread::current()->thread_safe_sender())); + ChildThreadImpl::current()->thread_safe_sender())); bluetooth_.reset( - new WebBluetoothImpl(ChildThread::current()->thread_safe_sender())); - thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); + new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); + thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); notification_dispatcher_ = - ChildThread::current()->notification_dispatcher(); - push_dispatcher_ = ChildThread::current()->push_dispatcher(); + ChildThreadImpl::current()->notification_dispatcher(); + push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); } if (main_thread_task_runner_.get()) { @@ -456,7 +456,7 @@ BlinkPlatformImpl::~BlinkPlatformImpl() { } WebURLLoader* BlinkPlatformImpl::createURLLoader() { - ChildThread* child_thread = ChildThread::current(); + ChildThreadImpl* child_thread = ChildThreadImpl::current(); // There may be no child thread in RenderViewTests. These tests can still use // data URLs to bypass the ResourceDispatcher. return new WebURLLoaderImpl( diff --git a/content/child/child_discardable_shared_memory_manager.cc b/content/child/child_discardable_shared_memory_manager.cc index 7d07e32..83d29d6 100644 --- a/content/child/child_discardable_shared_memory_manager.cc +++ b/content/child/child_discardable_shared_memory_manager.cc @@ -6,7 +6,6 @@ #include "base/memory/discardable_shared_memory.h" #include "base/process/process_metrics.h" -#include "content/child/child_thread.h" #include "content/common/child_process_messages.h" namespace content { diff --git a/content/child/child_gpu_memory_buffer_manager.cc b/content/child/child_gpu_memory_buffer_manager.cc index 7cb793d..0e1c312 100644 --- a/content/child/child_gpu_memory_buffer_manager.cc +++ b/content/child/child_gpu_memory_buffer_manager.cc @@ -4,7 +4,6 @@ #include "content/child/child_gpu_memory_buffer_manager.h" -#include "content/child/child_thread.h" #include "content/common/child_process_messages.h" #include "content/common/gpu/client/gpu_memory_buffer_impl.h" diff --git a/content/child/child_histogram_message_filter.cc b/content/child/child_histogram_message_filter.cc index 3e895fc..3e778d5 100644 --- a/content/child/child_histogram_message_filter.cc +++ b/content/child/child_histogram_message_filter.cc @@ -10,7 +10,6 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram_delta_serialization.h" #include "content/child/child_process.h" -#include "content/child/child_thread.h" #include "content/common/child_process_messages.h" #include "ipc/ipc_sender.h" diff --git a/content/child/child_message_filter.cc b/content/child/child_message_filter.cc index 9e5ff63..66b7555 100644 --- a/content/child/child_message_filter.cc +++ b/content/child/child_message_filter.cc @@ -8,7 +8,7 @@ #include "base/bind_helpers.h" #include "base/location.h" #include "base/task_runner.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/thread_safe_sender.h" #include "ipc/message_filter.h" @@ -52,7 +52,7 @@ base::TaskRunner* ChildMessageFilter::OverrideTaskRunnerForMessage( ChildMessageFilter::ChildMessageFilter() : internal_(NULL), - thread_safe_sender_(ChildThread::current()->thread_safe_sender()) {} + thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} ChildMessageFilter::~ChildMessageFilter() {} diff --git a/content/child/child_message_filter.h b/content/child/child_message_filter.h index a79ceec..e3dbdf8 100644 --- a/content/child/child_message_filter.h +++ b/content/child/child_message_filter.h @@ -51,7 +51,7 @@ class ChildMessageFilter private: class Internal; - friend class ChildThread; + friend class ChildThreadImpl; friend class RenderThreadImpl; friend class WorkerThread; diff --git a/content/child/child_process.cc b/content/child/child_process.cc index 42eff93..db73ea3 100644 --- a/content/child/child_process.cc +++ b/content/child/child_process.cc @@ -16,7 +16,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/threading/thread.h" #include "base/threading/thread_local.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #if defined(OS_ANDROID) #include "base/debug/debugger.h" @@ -72,11 +72,11 @@ ChildProcess::~ChildProcess() { io_thread_.Stop(); } -ChildThread* ChildProcess::main_thread() { +ChildThreadImpl* ChildProcess::main_thread() { return main_thread_.get(); } -void ChildProcess::set_main_thread(ChildThread* thread) { +void ChildProcess::set_main_thread(ChildThreadImpl* thread) { main_thread_.reset(thread); } diff --git a/content/child/child_process.h b/content/child/child_process.h index 1aedcb6..cf3173f 100644 --- a/content/child/child_process.h +++ b/content/child/child_process.h @@ -12,7 +12,7 @@ #include "content/common/content_export.h" namespace content { -class ChildThread; +class ChildThreadImpl; // Base class for child processes of the browser process (i.e. renderer and // plugin host). This is a singleton object for each child process. @@ -22,12 +22,12 @@ class ChildThread; // // 1. ChildProcess::~ChildProcess() is called. // 2. Shutdown event is fired. Background threads should stop. -// 3. ChildThread::Shutdown() is called. ChildThread is also deleted. +// 3. ChildThreadImpl::Shutdown() is called. ChildThread is also deleted. // 4. IO thread is stopped. // 5. Main message loop exits. // 6. Child process is now fully stopped. // -// Note: IO thread outlives the ChildThread object. +// Note: IO thread outlives the ChildThreadImpl object. class CONTENT_EXPORT ChildProcess { public: // Child processes should have an object that derives from this class. @@ -36,11 +36,11 @@ class CONTENT_EXPORT ChildProcess { virtual ~ChildProcess(); // May be NULL if the main thread hasn't been set explicitly. - ChildThread* main_thread(); + ChildThreadImpl* main_thread(); // Sets the object associated with the main thread of this process. // Takes ownership of the pointer. - void set_main_thread(ChildThread* thread); + void set_main_thread(ChildThreadImpl* thread); base::MessageLoop* io_message_loop() { return io_thread_.message_loop(); } base::MessageLoopProxy* io_message_loop_proxy() { @@ -81,7 +81,7 @@ class CONTENT_EXPORT ChildProcess { // NOTE: make sure that main_thread_ is listed after shutdown_event_, since // it depends on it (indirectly through IPC::SyncChannel). Same for // io_thread_. - scoped_ptr<ChildThread> main_thread_; + scoped_ptr<ChildThreadImpl> main_thread_; DISALLOW_COPY_AND_ASSIGN(ChildProcess); }; diff --git a/content/child/child_shared_bitmap_manager.cc b/content/child/child_shared_bitmap_manager.cc index 5cccb6d36..73395da 100644 --- a/content/child/child_shared_bitmap_manager.cc +++ b/content/child/child_shared_bitmap_manager.cc @@ -6,7 +6,7 @@ #include "base/debug/alias.h" #include "base/process/process_metrics.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/child_process_messages.h" #include "ui/gfx/geometry/size.h" @@ -111,7 +111,7 @@ ChildSharedBitmapManager::AllocateSharedMemoryBitmap(const gfx::Size& size) { if (!memory->Map(memory_size)) CHECK(false); #else - memory = ChildThread::AllocateSharedMemory(memory_size, sender_.get()); + memory = ChildThreadImpl::AllocateSharedMemory(memory_size, sender_.get()); #if defined(OS_WIN) if (!memory) CollectMemoryUsageAndDie(size); diff --git a/content/child/child_thread.cc b/content/child/child_thread_impl.cc index 82caa77..4db2e27 100644 --- a/content/child/child_thread.cc +++ b/content/child/child_thread_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include <signal.h> @@ -71,7 +71,7 @@ namespace { // How long to wait for a connection to the browser process before giving up. const int kConnectionTimeoutS = 15; -base::LazyInstance<base::ThreadLocalPointer<ChildThread> > g_lazy_tls = +base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls = LAZY_INSTANCE_INITIALIZER; // This isn't needed on Windows because there the sandbox's job object @@ -162,7 +162,7 @@ class SuicideOnChannelErrorFilter : public IPC::MessageFilter { #endif // OS(POSIX) #if defined(OS_ANDROID) -ChildThread* g_child_thread = NULL; +ChildThreadImpl* g_child_thread = NULL; // A lock protects g_child_thread. base::LazyInstance<base::Lock> g_lazy_child_thread_lock = @@ -199,50 +199,54 @@ void QuitMainThreadMessageLoop() { } // namespace -ChildThread::Options::Options() +ChildThread* ChildThread::Get() { + return ChildThreadImpl::current(); +} + +ChildThreadImpl::Options::Options() : channel_name(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kProcessChannelID)), use_mojo_channel(false), in_browser_process(false) { } -ChildThread::Options::Options(bool mojo) +ChildThreadImpl::Options::Options(bool mojo) : channel_name(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kProcessChannelID)), use_mojo_channel(mojo), in_browser_process(true) { } -ChildThread::Options::Options(std::string name, bool mojo) +ChildThreadImpl::Options::Options(std::string name, bool mojo) : channel_name(name), use_mojo_channel(mojo), in_browser_process(true) { } -ChildThread::Options::~Options() { +ChildThreadImpl::Options::~Options() { } -ChildThread::ChildThreadMessageRouter::ChildThreadMessageRouter( +ChildThreadImpl::ChildThreadMessageRouter::ChildThreadMessageRouter( IPC::Sender* sender) : sender_(sender) {} -bool ChildThread::ChildThreadMessageRouter::Send(IPC::Message* msg) { +bool ChildThreadImpl::ChildThreadMessageRouter::Send(IPC::Message* msg) { return sender_->Send(msg); } -ChildThread::ChildThread() +ChildThreadImpl::ChildThreadImpl() : router_(this), in_browser_process_(false), channel_connected_factory_(this) { Init(Options()); } -ChildThread::ChildThread(const Options& options) +ChildThreadImpl::ChildThreadImpl(const Options& options) : router_(this), in_browser_process_(options.in_browser_process), channel_connected_factory_(this) { Init(options); } -void ChildThread::ConnectChannel(bool use_mojo_channel) { +void ChildThreadImpl::ConnectChannel(bool use_mojo_channel) { bool create_pipe_now = true; if (use_mojo_channel) { VLOG(1) << "Mojo is enabled on child"; @@ -255,7 +259,7 @@ void ChildThread::ConnectChannel(bool use_mojo_channel) { channel_->Init(channel_name_, IPC::Channel::MODE_CLIENT, create_pipe_now); } -void ChildThread::Init(const Options& options) { +void ChildThreadImpl::Init(const Options& options) { channel_name_ = options.channel_name; g_lazy_tls.Pointer()->Set(this); @@ -363,7 +367,7 @@ void ChildThread::Init(const Options& options) { base::MessageLoop::current()->PostDelayedTask( FROM_HERE, - base::Bind(&ChildThread::EnsureConnected, + base::Bind(&ChildThreadImpl::EnsureConnected, channel_connected_factory_.GetWeakPtr()), base::TimeDelta::FromSeconds(connection_timeout)); @@ -395,7 +399,7 @@ void ChildThread::Init(const Options& options) { new ChildDiscardableSharedMemoryManager(thread_safe_sender())); } -ChildThread::~ChildThread() { +ChildThreadImpl::~ChildThreadImpl() { #ifdef IPC_MESSAGE_LOG_ENABLED IPC::Logging::GetInstance()->SetIPCSender(NULL); #endif @@ -415,7 +419,7 @@ ChildThread::~ChildThread() { g_lazy_tls.Pointer()->Set(NULL); } -void ChildThread::Shutdown() { +void ChildThreadImpl::Shutdown() { // Delete objects that hold references to blink so derived classes can // safely shutdown blink in their Shutdown implementation. file_system_dispatcher_.reset(); @@ -423,16 +427,16 @@ void ChildThread::Shutdown() { WebFileSystemImpl::DeleteThreadSpecificInstance(); } -void ChildThread::OnChannelConnected(int32 peer_pid) { +void ChildThreadImpl::OnChannelConnected(int32 peer_pid) { channel_connected_factory_.InvalidateWeakPtrs(); } -void ChildThread::OnChannelError() { +void ChildThreadImpl::OnChannelError() { set_on_channel_error_called(true); base::MessageLoop::current()->Quit(); } -bool ChildThread::Send(IPC::Message* msg) { +bool ChildThreadImpl::Send(IPC::Message* msg) { DCHECK(base::MessageLoop::current() == message_loop()); if (!channel_) { delete msg; @@ -442,19 +446,29 @@ bool ChildThread::Send(IPC::Message* msg) { return channel_->Send(msg); } -MessageRouter* ChildThread::GetRouter() { +#if defined(OS_WIN) +void ChildThreadImpl::PreCacheFont(const LOGFONT& log_font) { + Send(new ChildProcessHostMsg_PreCacheFont(log_font)); +} + +void ChildThreadImpl::ReleaseCachedFonts() { + Send(new ChildProcessHostMsg_ReleaseCachedFonts()); +} +#endif + +MessageRouter* ChildThreadImpl::GetRouter() { DCHECK(base::MessageLoop::current() == message_loop()); return &router_; } -scoped_ptr<base::SharedMemory> ChildThread::AllocateSharedMemory( +scoped_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( size_t buf_size) { DCHECK(base::MessageLoop::current() == message_loop()); return AllocateSharedMemory(buf_size, this); } // static -scoped_ptr<base::SharedMemory> ChildThread::AllocateSharedMemory( +scoped_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( size_t buf_size, IPC::Sender* sender) { scoped_ptr<base::SharedMemory> shared_buf; @@ -484,7 +498,7 @@ scoped_ptr<base::SharedMemory> ChildThread::AllocateSharedMemory( return shared_buf; } -bool ChildThread::OnMessageReceived(const IPC::Message& msg) { +bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) { if (mojo_application_->OnMessageReceived(msg)) return true; @@ -497,7 +511,7 @@ bool ChildThread::OnMessageReceived(const IPC::Message& msg) { return true; bool handled = true; - IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) + IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) #if defined(IPC_MESSAGE_LOG_ENABLED) IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, @@ -525,16 +539,16 @@ bool ChildThread::OnMessageReceived(const IPC::Message& msg) { return router_.OnMessageReceived(msg); } -bool ChildThread::OnControlMessageReceived(const IPC::Message& msg) { +bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { return false; } -void ChildThread::OnShutdown() { +void ChildThreadImpl::OnShutdown() { base::MessageLoop::current()->Quit(); } #if defined(IPC_MESSAGE_LOG_ENABLED) -void ChildThread::OnSetIPCLoggingEnabled(bool enable) { +void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { if (enable) IPC::Logging::GetInstance()->Enable(); else @@ -542,11 +556,11 @@ void ChildThread::OnSetIPCLoggingEnabled(bool enable) { } #endif // IPC_MESSAGE_LOG_ENABLED -void ChildThread::OnSetProfilerStatus(ThreadData::Status status) { +void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { ThreadData::InitializeAndSetTrackingStatus(status); } -void ChildThread::OnGetChildProfilerData(int sequence_number) { +void ChildThreadImpl::OnGetChildProfilerData(int sequence_number) { tracked_objects::ProcessDataSnapshot process_data; ThreadData::Snapshot(false, &process_data); @@ -554,7 +568,7 @@ void ChildThread::OnGetChildProfilerData(int sequence_number) { process_data)); } -void ChildThread::OnDumpHandles() { +void ChildThreadImpl::OnDumpHandles() { #if defined(OS_WIN) scoped_refptr<HandleEnumerator> handle_enum( new HandleEnumerator( @@ -568,7 +582,7 @@ void ChildThread::OnDumpHandles() { } #if defined(USE_TCMALLOC) -void ChildThread::OnGetTcmallocStats() { +void ChildThreadImpl::OnGetTcmallocStats() { std::string result; char buffer[1024 * 32]; base::allocator::GetStats(buffer, sizeof(buffer)); @@ -577,15 +591,15 @@ void ChildThread::OnGetTcmallocStats() { } #endif -ChildThread* ChildThread::current() { +ChildThreadImpl* ChildThreadImpl::current() { return g_lazy_tls.Pointer()->Get(); } #if defined(OS_ANDROID) // The method must NOT be called on the child thread itself. // It may block the child thread if so. -void ChildThread::ShutdownThread() { - DCHECK(!ChildThread::current()) << +void ChildThreadImpl::ShutdownThread() { + DCHECK(!ChildThreadImpl::current()) << "this method should NOT be called from child thread itself"; { base::AutoLock lock(g_lazy_child_thread_lock.Get()); @@ -598,7 +612,7 @@ void ChildThread::ShutdownThread() { } #endif -void ChildThread::OnProcessFinalRelease() { +void ChildThreadImpl::OnProcessFinalRelease() { if (on_channel_error_called_) { base::MessageLoop::current()->Quit(); return; @@ -613,12 +627,12 @@ void ChildThread::OnProcessFinalRelease() { Send(new ChildProcessHostMsg_ShutdownRequest); } -void ChildThread::EnsureConnected() { - VLOG(0) << "ChildThread::EnsureConnected()"; +void ChildThreadImpl::EnsureConnected() { + VLOG(0) << "ChildThreadImpl::EnsureConnected()"; base::KillProcess(base::GetCurrentProcessHandle(), 0, false); } -void ChildThread::OnProcessBackgrounded(bool background) { +void ChildThreadImpl::OnProcessBackgrounded(bool background) { // Set timer slack to maximum on main thread when in background. base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; if (background) diff --git a/content/child/child_thread.h b/content/child/child_thread_impl.h index 24cfc61..e4f5c3f 100644 --- a/content/child/child_thread.h +++ b/content/child/child_thread_impl.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_CHILD_CHILD_THREAD_H_ -#define CONTENT_CHILD_CHILD_THREAD_H_ +#ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_ +#define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ #include <string> @@ -16,6 +16,7 @@ #include "content/child/mojo/mojo_application.h" #include "content/common/content_export.h" #include "content/common/message_router.h" +#include "content/public/child/child_thread.h" #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. namespace base { @@ -57,7 +58,9 @@ class WebSocketDispatcher; struct RequestInfo; // The main thread of a child process derives from this class. -class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { +class CONTENT_EXPORT ChildThreadImpl + : public IPC::Listener, + virtual public ChildThread { public: struct CONTENT_EXPORT Options { Options(); @@ -72,21 +75,27 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { }; // Creates the thread. - ChildThread(); + ChildThreadImpl(); // Allow to be used for single-process mode and for in process gpu mode via // options. - explicit ChildThread(const Options& options); + explicit ChildThreadImpl(const Options& options); // ChildProcess::main_thread() is reset after Shutdown(), and before the // destructor, so any subsystem that relies on ChildProcess::main_thread() // must be terminated before Shutdown returns. In particular, if a subsystem // has a thread that post tasks to ChildProcess::main_thread(), that thread // should be joined in Shutdown(). - ~ChildThread() override; + ~ChildThreadImpl() override; virtual void Shutdown(); // IPC::Sender implementation: bool Send(IPC::Message* msg) override; + // ChildThread implementation: +#if defined(OS_WIN) + void PreCacheFont(const LOGFONT& log_font) override; + void ReleaseCachedFonts() override; +#endif + IPC::SyncChannel* channel() { return channel_.get(); } MessageRouter* GetRouter(); @@ -170,7 +179,7 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { base::MessageLoop* message_loop() const { return message_loop_; } // Returns the one child thread. Can only be called on the main thread. - static ChildThread* current(); + static ChildThreadImpl* current(); #if defined(OS_ANDROID) // Called on Android's service thread to shutdown the main thread of this @@ -241,7 +250,8 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { scoped_refptr<ThreadSafeSender> thread_safe_sender_; - // Implements message routing functionality to the consumers of ChildThread. + // Implements message routing functionality to the consumers of + // ChildThreadImpl. ChildThreadMessageRouter router_; // Handles resource loads for this process. @@ -292,11 +302,11 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { bool in_browser_process_; - base::WeakPtrFactory<ChildThread> channel_connected_factory_; + base::WeakPtrFactory<ChildThreadImpl> channel_connected_factory_; - DISALLOW_COPY_AND_ASSIGN(ChildThread); + DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); }; } // namespace content -#endif // CONTENT_CHILD_CHILD_THREAD_H_ +#endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ diff --git a/content/child/fileapi/file_system_dispatcher.cc b/content/child/fileapi/file_system_dispatcher.cc index 8ba8764..1a742db 100644 --- a/content/child/fileapi/file_system_dispatcher.cc +++ b/content/child/fileapi/file_system_dispatcher.cc @@ -8,7 +8,7 @@ #include "base/files/file_util.h" #include "base/message_loop/message_loop_proxy.h" #include "base/process/process.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/fileapi/file_system_messages.h" #include "storage/common/fileapi/file_system_info.h" @@ -171,7 +171,7 @@ void FileSystemDispatcher::OpenFileSystem( const StatusCallback& error_callback) { int request_id = dispatchers_.Add( CallbackDispatcher::Create(success_callback, error_callback)); - ChildThread::current()->Send(new FileSystemHostMsg_OpenFileSystem( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_OpenFileSystem( request_id, origin_url, type)); } @@ -181,7 +181,7 @@ void FileSystemDispatcher::ResolveURL( const StatusCallback& error_callback) { int request_id = dispatchers_.Add( CallbackDispatcher::Create(success_callback, error_callback)); - ChildThread::current()->Send(new FileSystemHostMsg_ResolveURL( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_ResolveURL( request_id, filesystem_url)); } @@ -189,7 +189,7 @@ void FileSystemDispatcher::DeleteFileSystem(const GURL& origin_url, storage::FileSystemType type, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send(new FileSystemHostMsg_DeleteFileSystem( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_DeleteFileSystem( request_id, origin_url, type)); } @@ -198,7 +198,7 @@ void FileSystemDispatcher::Move( const GURL& dest_path, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send(new FileSystemHostMsg_Move( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_Move( request_id, src_path, dest_path)); } @@ -207,7 +207,7 @@ void FileSystemDispatcher::Copy( const GURL& dest_path, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send(new FileSystemHostMsg_Copy( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_Copy( request_id, src_path, dest_path)); } @@ -216,7 +216,7 @@ void FileSystemDispatcher::Remove( bool recursive, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_Remove(request_id, path, recursive)); } @@ -226,7 +226,7 @@ void FileSystemDispatcher::ReadMetadata( const StatusCallback& error_callback) { int request_id = dispatchers_.Add( CallbackDispatcher::Create(success_callback, error_callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_ReadMetadata(request_id, path)); } @@ -235,7 +235,7 @@ void FileSystemDispatcher::CreateFile( bool exclusive, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send(new FileSystemHostMsg_Create( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_Create( request_id, path, exclusive, false /* is_directory */, false /* recursive */)); } @@ -246,7 +246,7 @@ void FileSystemDispatcher::CreateDirectory( bool recursive, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send(new FileSystemHostMsg_Create( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_Create( request_id, path, exclusive, true /* is_directory */, recursive)); } @@ -255,7 +255,7 @@ void FileSystemDispatcher::Exists( bool is_directory, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_Exists(request_id, path, is_directory)); } @@ -265,7 +265,7 @@ void FileSystemDispatcher::ReadDirectory( const StatusCallback& error_callback) { int request_id = dispatchers_.Add( CallbackDispatcher::Create(success_callback, error_callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_ReadDirectory(request_id, path)); } @@ -275,7 +275,7 @@ void FileSystemDispatcher::Truncate( int* request_id_out, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_Truncate(request_id, path, offset)); if (request_id_out) @@ -291,7 +291,7 @@ void FileSystemDispatcher::Write( const StatusCallback& error_callback) { int request_id = dispatchers_.Add( CallbackDispatcher::Create(success_callback, error_callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_Write(request_id, path, blob_id, offset)); if (request_id_out) @@ -302,7 +302,7 @@ void FileSystemDispatcher::Cancel( int request_id_to_cancel, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite( + ChildThreadImpl::current()->Send(new FileSystemHostMsg_CancelWrite( request_id, request_id_to_cancel)); } @@ -312,7 +312,7 @@ void FileSystemDispatcher::TouchFile( const base::Time& last_modified_time, const StatusCallback& callback) { int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_TouchFile( request_id, path, last_access_time, last_modified_time)); } @@ -323,7 +323,7 @@ void FileSystemDispatcher::CreateSnapshotFile( const StatusCallback& error_callback) { int request_id = dispatchers_.Add( CallbackDispatcher::Create(success_callback, error_callback)); - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new FileSystemHostMsg_CreateSnapshotFile( request_id, file_path)); } diff --git a/content/child/fileapi/webfilesystem_impl.cc b/content/child/fileapi/webfilesystem_impl.cc index 8fe0243..f41377f 100644 --- a/content/child/fileapi/webfilesystem_impl.cc +++ b/content/child/fileapi/webfilesystem_impl.cc @@ -11,7 +11,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread_local.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/file_info_util.h" #include "content/child/fileapi/file_system_dispatcher.h" #include "content/child/fileapi/webfilewriter_impl.h" @@ -86,8 +86,8 @@ base::LazyInstance<base::ThreadLocalPointer<WebFileSystemImpl> >::Leaky g_webfilesystem_tls = LAZY_INSTANCE_INITIALIZER; void DidReceiveSnapshotFile(int request_id) { - if (ChildThread::current()) - ChildThread::current()->Send( + if (ChildThreadImpl::current()) + ChildThreadImpl::current()->Send( new FileSystemHostMsg_DidReceiveSnapshotFile(request_id)); } @@ -110,12 +110,12 @@ void CallDispatcherOnMainThread( return; waitable_results->WaitAndRun(); } - if (!ChildThread::current() || - !ChildThread::current()->file_system_dispatcher()) + if (!ChildThreadImpl::current() || + !ChildThreadImpl::current()->file_system_dispatcher()) return; DCHECK(!waitable_results); - DispatchToMethod(ChildThread::current()->file_system_dispatcher(), + DispatchToMethod(ChildThreadImpl::current()->file_system_dispatcher(), method, params); } diff --git a/content/child/fileapi/webfilewriter_impl.cc b/content/child/fileapi/webfilewriter_impl.cc index a8fd3ea..0af17b8 100644 --- a/content/child/fileapi/webfilewriter_impl.cc +++ b/content/child/fileapi/webfilewriter_impl.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/synchronization/waitable_event.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/fileapi/file_system_dispatcher.h" #include "content/child/worker_task_runner.h" @@ -15,8 +15,8 @@ namespace content { namespace { FileSystemDispatcher* GetFileSystemDispatcher() { - return ChildThread::current() ? - ChildThread::current()->file_system_dispatcher() : NULL; + return ChildThreadImpl::current() ? + ChildThreadImpl::current()->file_system_dispatcher() : NULL; } } // namespace @@ -42,7 +42,7 @@ class WebFileWriterImpl::WriterBridge status_callback_ = status_callback; if (!GetFileSystemDispatcher()) return; - ChildThread::current()->file_system_dispatcher()->Truncate( + ChildThreadImpl::current()->file_system_dispatcher()->Truncate( path, offset, &request_id_, base::Bind(&WriterBridge::DidFinish, this)); } @@ -54,7 +54,7 @@ class WebFileWriterImpl::WriterBridge status_callback_ = error_callback; if (!GetFileSystemDispatcher()) return; - ChildThread::current()->file_system_dispatcher()->Write( + ChildThreadImpl::current()->file_system_dispatcher()->Write( path, id, offset, &request_id_, base::Bind(&WriterBridge::DidWrite, this), base::Bind(&WriterBridge::DidFinish, this)); @@ -64,7 +64,7 @@ class WebFileWriterImpl::WriterBridge status_callback_ = status_callback; if (!GetFileSystemDispatcher()) return; - ChildThread::current()->file_system_dispatcher()->Cancel( + ChildThreadImpl::current()->file_system_dispatcher()->Cancel( request_id_, base::Bind(&WriterBridge::DidFinish, this)); } diff --git a/content/child/notifications/notification_image_loader.cc b/content/child/notifications/notification_image_loader.cc index b2eb23e..c194b02 100644 --- a/content/child/notifications/notification_image_loader.cc +++ b/content/child/notifications/notification_image_loader.cc @@ -5,7 +5,7 @@ #include "content/child/notifications/notification_image_loader.h" #include "base/logging.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/image_decoder.h" #include "content/child/worker_task_runner.h" #include "third_party/WebKit/public/platform/Platform.h" @@ -29,7 +29,7 @@ NotificationImageLoader::~NotificationImageLoader() {} void NotificationImageLoader::StartOnMainThread(const WebURL& image_url, int worker_thread_id) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); DCHECK(!url_loader_); worker_thread_id_ = worker_thread_id; diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc index c7db56c..15bd602 100644 --- a/content/child/npapi/plugin_url_fetcher.cc +++ b/content/child/npapi/plugin_url_fetcher.cc @@ -5,7 +5,7 @@ #include "content/child/npapi/plugin_url_fetcher.h" #include "base/memory/scoped_ptr.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/multipart_response_delegate.h" #include "content/child/npapi/plugin_host.h" #include "content/child/npapi/plugin_instance.h" @@ -146,7 +146,7 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream, request_info.headers = std::string("Range: ") + range; } - bridge_.reset(ChildThread::current()->resource_dispatcher()->CreateBridge( + bridge_.reset(ChildThreadImpl::current()->resource_dispatcher()->CreateBridge( request_info)); if (!body.empty()) { scoped_refptr<ResourceRequestBody> request_body = diff --git a/content/child/quota_dispatcher.cc b/content/child/quota_dispatcher.cc index 1a1577a..fa766db 100644 --- a/content/child/quota_dispatcher.cc +++ b/content/child/quota_dispatcher.cc @@ -7,7 +7,6 @@ #include "base/basictypes.h" #include "base/lazy_instance.h" #include "base/threading/thread_local.h" -#include "content/child/child_thread.h" #include "content/child/quota_message_filter.h" #include "content/child/thread_safe_sender.h" #include "content/common/quota_messages.h" diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc index ba7fe6f..bccff3b 100644 --- a/content/child/resource_dispatcher.cc +++ b/content/child/resource_dispatcher.cc @@ -16,7 +16,6 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/strings/string_util.h" -#include "content/child/child_thread.h" #include "content/child/request_extra_data.h" #include "content/child/request_info.h" #include "content/child/resource_loader_bridge.h" diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc index fce8783..99230db 100644 --- a/content/child/service_worker/service_worker_dispatcher.cc +++ b/content/child/service_worker/service_worker_dispatcher.cc @@ -8,7 +8,7 @@ #include "base/stl_util.h" #include "base/threading/thread_local.h" #include "base/trace_event/trace_event.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/service_worker/service_worker_handle_reference.h" #include "content/child/service_worker/service_worker_provider_context.h" #include "content/child/service_worker/service_worker_registration_handle_reference.h" @@ -638,7 +638,7 @@ void ServiceWorkerDispatcher::OnPostMessage( const std::vector<int>& new_routing_ids) { // Make sure we're on the main document thread. (That must be the only // thread we get this message) - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); TRACE_EVENT1("ServiceWorker", "ServiceWorkerDispatcher::OnPostMessage", "Thread ID", thread_id); diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc index db09351..915a1c9 100644 --- a/content/child/service_worker/service_worker_network_provider.cc +++ b/content/child/service_worker/service_worker_network_provider.cc @@ -5,7 +5,7 @@ #include "content/child/service_worker/service_worker_network_provider.h" #include "base/atomic_sequence_num.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/service_worker/service_worker_provider_context.h" #include "content/common/service_worker/service_worker_messages.h" @@ -38,24 +38,24 @@ ServiceWorkerNetworkProvider* ServiceWorkerNetworkProvider::FromDocumentState( ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(int render_frame_id) : provider_id_(GetNextProviderId()), context_(new ServiceWorkerProviderContext(provider_id_)) { - if (!ChildThread::current()) + if (!ChildThreadImpl::current()) return; // May be null in some tests. - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new ServiceWorkerHostMsg_ProviderCreated(provider_id_, render_frame_id)); } ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { - if (!ChildThread::current()) + if (!ChildThreadImpl::current()) return; // May be null in some tests. - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_)); } void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId( int64 version_id) { - if (!ChildThread::current()) + if (!ChildThreadImpl::current()) return; // May be null in some tests. - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); } diff --git a/content/child/service_worker/service_worker_provider_context.cc b/content/child/service_worker/service_worker_provider_context.cc index 129d557..d8273aa 100644 --- a/content/child/service_worker/service_worker_provider_context.cc +++ b/content/child/service_worker/service_worker_provider_context.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop_proxy.h" #include "base/stl_util.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/service_worker/service_worker_dispatcher.h" #include "content/child/service_worker/service_worker_handle_reference.h" #include "content/child/service_worker/service_worker_registration_handle_reference.h" @@ -20,9 +20,9 @@ namespace content { ServiceWorkerProviderContext::ServiceWorkerProviderContext(int provider_id) : provider_id_(provider_id), main_thread_loop_proxy_(base::MessageLoopProxy::current()) { - if (!ChildThread::current()) + if (!ChildThreadImpl::current()) return; // May be null in some tests. - thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); + thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); ServiceWorkerDispatcher* dispatcher = ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( thread_safe_sender_.get()); diff --git a/content/child/service_worker/web_service_worker_provider_impl.cc b/content/child/service_worker/web_service_worker_provider_impl.cc index 52b6656..5b7d7406 100644 --- a/content/child/service_worker/web_service_worker_provider_impl.cc +++ b/content/child/service_worker/web_service_worker_provider_impl.cc @@ -6,7 +6,6 @@ #include "base/atomic_sequence_num.h" #include "base/logging.h" -#include "content/child/child_thread.h" #include "content/child/service_worker/service_worker_dispatcher.h" #include "content/child/service_worker/service_worker_handle_reference.h" #include "content/child/service_worker/service_worker_provider_context.h" diff --git a/content/child/shared_worker_devtools_agent.cc b/content/child/shared_worker_devtools_agent.cc index 3a9b350..26a51ed 100644 --- a/content/child/shared_worker_devtools_agent.cc +++ b/content/child/shared_worker_devtools_agent.cc @@ -4,7 +4,7 @@ #include "content/child/shared_worker_devtools_agent.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/devtools_messages.h" #include "ipc/ipc_channel.h" #include "third_party/WebKit/public/platform/WebCString.h" @@ -95,7 +95,7 @@ void SharedWorkerDevToolsAgent::OnDispatchOnInspectorBackend( } bool SharedWorkerDevToolsAgent::Send(IPC::Message* message) { - return ChildThread::current()->Send(message); + return ChildThreadImpl::current()->Send(message); } } // namespace content diff --git a/content/child/thread_safe_sender.cc b/content/child/thread_safe_sender.cc index d9ecfd1..b8aef12 100644 --- a/content/child/thread_safe_sender.cc +++ b/content/child/thread_safe_sender.cc @@ -5,7 +5,7 @@ #include "content/child/thread_safe_sender.h" #include "base/message_loop/message_loop_proxy.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "ipc/ipc_sync_message_filter.h" namespace content { @@ -21,7 +21,7 @@ ThreadSafeSender::~ThreadSafeSender() { bool ThreadSafeSender::Send(IPC::Message* msg) { if (main_loop_->BelongsToCurrentThread()) - return ChildThread::current()->Send(msg); + return ChildThreadImpl::current()->Send(msg); return sync_filter_->Send(msg); } diff --git a/content/child/thread_safe_sender.h b/content/child/thread_safe_sender.h index 443e20a..37ad96b 100644 --- a/content/child/thread_safe_sender.h +++ b/content/child/thread_safe_sender.h @@ -19,9 +19,9 @@ class SyncMessageFilter; } namespace content { -class ChildThread; +class ChildThreadImpl; -// The class of Sender returned by ChildThread::thread_safe_sender(). +// The class of Sender returned by ChildThreadImpl::thread_safe_sender(). class CONTENT_EXPORT ThreadSafeSender : public IPC::Sender, public base::RefCountedThreadSafe<ThreadSafeSender> { @@ -29,7 +29,7 @@ class CONTENT_EXPORT ThreadSafeSender bool Send(IPC::Message* msg) override; private: - friend class ChildThread; // for construction + friend class ChildThreadImpl; // for construction friend class IndexedDBDispatcherTest; friend class WebIDBCursorImplTest; friend class base::RefCountedThreadSafe<ThreadSafeSender>; diff --git a/content/child/threaded_data_provider.cc b/content/child/threaded_data_provider.cc index ccfe891..69ed34b 100644 --- a/content/child/threaded_data_provider.cc +++ b/content/child/threaded_data_provider.cc @@ -5,7 +5,7 @@ #include "content/child/threaded_data_provider.h" #include "content/child/child_process.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/resource_dispatcher.h" #include "content/child/thread_safe_sender.h" #include "content/child/webthread_impl.h" @@ -127,12 +127,12 @@ ThreadedDataProvider::ThreadedDataProvider( shm_size_(shm_size), background_thread_(static_cast<WebThreadImpl&>( *threaded_data_receiver->backgroundThread())), - ipc_channel_(ChildThread::current()->channel()), + ipc_channel_(ChildThreadImpl::current()->channel()), threaded_data_receiver_(threaded_data_receiver), resource_filter_active_(false), main_thread_task_runner_(main_thread_task_runner), main_thread_weak_factory_(this) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); DCHECK(ipc_channel_); DCHECK(threaded_data_receiver_); DCHECK(main_thread_task_runner_.get()); @@ -146,19 +146,19 @@ ThreadedDataProvider::ThreadedDataProvider( background_thread_weak_factory_->GetWeakPtr(), main_thread_weak_factory_.GetWeakPtr(), request_id); - ChildThread::current()->channel()->AddFilter(filter_.get()); + ChildThreadImpl::current()->channel()->AddFilter(filter_.get()); } ThreadedDataProvider::~ThreadedDataProvider() { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); - ChildThread::current()->channel()->RemoveFilter(filter_.get()); + ChildThreadImpl::current()->channel()->RemoveFilter(filter_.get()); delete threaded_data_receiver_; } void DestructOnMainThread(ThreadedDataProvider* data_provider) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); // The ThreadedDataProvider must be destructed on the main thread to // be threadsafe when removing the message filter and releasing the shared @@ -167,7 +167,7 @@ void DestructOnMainThread(ThreadedDataProvider* data_provider) { } void ThreadedDataProvider::Stop() { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); // Make sure we don't get called by on the main thread anymore via weak // pointers we've passed to the filter. @@ -207,7 +207,7 @@ void ThreadedDataProvider::StopOnBackgroundThread() { } void ThreadedDataProvider::OnResourceMessageFilterAddedMainThread() { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); DCHECK(background_thread_weak_factory_); // We bounce this message from the I/O thread via the main thread and then @@ -264,7 +264,7 @@ void ThreadedDataProvider::OnReceivedDataOnBackgroundThread( void ThreadedDataProvider::OnReceivedDataOnForegroundThread( const char* data, int data_length, int encoded_data_length) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); background_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(&ThreadedDataProvider::ForwardAndACKData, diff --git a/content/child/webblobregistry_impl.cc b/content/child/webblobregistry_impl.cc index 81a1f4b..7b4ec42 100644 --- a/content/child/webblobregistry_impl.cc +++ b/content/child/webblobregistry_impl.cc @@ -9,7 +9,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/shared_memory.h" #include "base/message_loop/message_loop.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/thread_safe_sender.h" #include "content/common/fileapi/webblob_messages.h" #include "storage/common/data_element.h" @@ -158,7 +158,7 @@ void WebBlobRegistryImpl::SendOversizedDataForBlob( // writing it directly to the IPC channel. size_t shared_memory_size = std::min(data.size(), kMaxSharedMemoryBytes); scoped_ptr<base::SharedMemory> shared_memory( - ChildThread::AllocateSharedMemory(shared_memory_size, sender_.get())); + ChildThreadImpl::AllocateSharedMemory(shared_memory_size, sender_.get())); CHECK(shared_memory.get()); if (!shared_memory->Map(shared_memory_size)) CHECK(false); @@ -179,19 +179,19 @@ void WebBlobRegistryImpl::SendOversizedDataForBlob( void WebBlobRegistryImpl::registerStreamURL( const WebURL& url, const WebString& content_type) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); sender_->Send(new StreamHostMsg_StartBuilding(url, content_type.utf8())); } void WebBlobRegistryImpl::registerStreamURL( const WebURL& url, const WebURL& src_url) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); sender_->Send(new StreamHostMsg_Clone(url, src_url)); } void WebBlobRegistryImpl::addDataToStream(const WebURL& url, const char* data, size_t length) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); if (length == 0) return; if (length < kLargeThresholdBytes) { @@ -204,8 +204,8 @@ void WebBlobRegistryImpl::addDataToStream(const WebURL& url, size_t shared_memory_size = std::min( length, kMaxSharedMemoryBytes); scoped_ptr<base::SharedMemory> shared_memory( - ChildThread::AllocateSharedMemory(shared_memory_size, - sender_.get())); + ChildThreadImpl::AllocateSharedMemory(shared_memory_size, + sender_.get())); CHECK(shared_memory.get()); if (!shared_memory->Map(shared_memory_size)) CHECK(false); @@ -224,22 +224,22 @@ void WebBlobRegistryImpl::addDataToStream(const WebURL& url, } void WebBlobRegistryImpl::flushStream(const WebURL& url) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); sender_->Send(new StreamHostMsg_Flush(url)); } void WebBlobRegistryImpl::finalizeStream(const WebURL& url) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); sender_->Send(new StreamHostMsg_FinishBuilding(url)); } void WebBlobRegistryImpl::abortStream(const WebURL& url) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); sender_->Send(new StreamHostMsg_AbortBuilding(url)); } void WebBlobRegistryImpl::unregisterStreamURL(const WebURL& url) { - DCHECK(ChildThread::current()); + DCHECK(ChildThreadImpl::current()); sender_->Send(new StreamHostMsg_Remove(url)); } diff --git a/content/child/webmessageportchannel_impl.cc b/content/child/webmessageportchannel_impl.cc index c3de36f..725e595 100644 --- a/content/child/webmessageportchannel_impl.cc +++ b/content/child/webmessageportchannel_impl.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop_proxy.h" #include "content/child/child_process.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/message_port_messages.h" #include "third_party/WebKit/public/platform/WebMessagePortChannelClient.h" #include "third_party/WebKit/public/platform/WebString.h" @@ -56,7 +56,7 @@ WebMessagePortChannelImpl::~WebMessagePortChannelImpl() { Send(new MessagePortHostMsg_DestroyMessagePort(message_port_id_)); if (route_id_ != MSG_ROUTING_NONE) - ChildThread::current()->GetRouter()->RemoveRoute(route_id_); + ChildThreadImpl::current()->GetRouter()->RemoveRoute(route_id_); } // static @@ -169,7 +169,7 @@ void WebMessagePortChannelImpl::Init() { Send(new MessagePortHostMsg_ReleaseMessages(message_port_id_)); } - ChildThread::current()->GetRouter()->AddRoute(route_id_, this); + ChildThreadImpl::current()->GetRouter()->AddRoute(route_id_, this); } void WebMessagePortChannelImpl::Entangle( @@ -216,7 +216,7 @@ void WebMessagePortChannelImpl::Send(IPC::Message* message) { return; } - ChildThread::current()->GetRouter()->Send(message); + ChildThreadImpl::current()->GetRouter()->Send(message); } bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { diff --git a/content/child/websocket_bridge.cc b/content/child/websocket_bridge.cc index 5b32702..e091023 100644 --- a/content/child/websocket_bridge.cc +++ b/content/child/websocket_bridge.cc @@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/strings/string_util.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/websocket_dispatcher.h" #include "content/common/websocket.h" #include "content/common/websocket_messages.h" @@ -52,7 +52,7 @@ WebSocketBridge::~WebSocketBridge() { if (channel_id_ != kInvalidChannelId) { // The connection is abruptly disconnected by the renderer without // closing handshake. - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new WebSocketMsg_DropChannel(channel_id_, false, kAbnormalShutdownOpCode, @@ -214,7 +214,7 @@ void WebSocketBridge::connect( WebSocketHandleClient* client) { DCHECK_EQ(kInvalidChannelId, channel_id_); WebSocketDispatcher* dispatcher = - ChildThread::current()->websocket_dispatcher(); + ChildThreadImpl::current()->websocket_dispatcher(); channel_id_ = dispatcher->AddBridge(this); client_ = client; @@ -227,7 +227,7 @@ void WebSocketBridge::connect( << JoinString(protocols_to_pass, ", ") << "), " << origin_to_pass.string() << ")"; - ChildThread::current()->Send(new WebSocketHostMsg_AddChannelRequest( + ChildThreadImpl::current()->Send(new WebSocketHostMsg_AddChannelRequest( channel_id_, url, protocols_to_pass, origin_to_pass, render_frame_id_)); } @@ -255,7 +255,7 @@ void WebSocketBridge::send(bool fin, << fin << ", " << type_to_pass << ", " << "(data size = " << size << "))"; - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new WebSocketMsg_SendFrame(channel_id_, fin, type_to_pass, @@ -268,7 +268,7 @@ void WebSocketBridge::flowControl(int64_t quota) { DVLOG(1) << "Bridge #" << channel_id_ << " FlowControl(" << quota << ")"; - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new WebSocketMsg_FlowControl(channel_id_, quota)); } @@ -281,7 +281,7 @@ void WebSocketBridge::close(unsigned short code, DVLOG(1) << "Bridge #" << channel_id_ << " Close(" << code << ", " << reason_to_pass << ")"; // This method is for closing handshake and hence |was_clean| shall be true. - ChildThread::current()->Send( + ChildThreadImpl::current()->Send( new WebSocketMsg_DropChannel(channel_id_, true, code, reason_to_pass)); } @@ -289,7 +289,7 @@ void WebSocketBridge::Disconnect() { if (channel_id_ == kInvalidChannelId) return; WebSocketDispatcher* dispatcher = - ChildThread::current()->websocket_dispatcher(); + ChildThreadImpl::current()->websocket_dispatcher(); dispatcher->RemoveBridge(channel_id_); channel_id_ = kInvalidChannelId; diff --git a/content/content_child.gypi b/content/content_child.gypi index 013d2e5..bfde2e2 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -23,6 +23,7 @@ ], 'variables': { 'public_child_sources': [ + 'public/child/child_thread.h', 'public/child/image_decoder_utils.h', 'public/child/request_peer.h', 'public/child/resource_dispatcher_delegate.h', @@ -61,8 +62,8 @@ 'child/child_resource_message_filter.h', 'child/child_shared_bitmap_manager.cc', 'child/child_shared_bitmap_manager.h', - 'child/child_thread.cc', - 'child/child_thread.h', + 'child/child_thread_impl.cc', + 'child/child_thread_impl.h', 'child/content_child_helpers.cc', 'child/content_child_helpers.h', 'child/database_util.cc', diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc index b7846f4..1064a70 100644 --- a/content/gpu/gpu_child_thread.cc +++ b/content/gpu/gpu_child_thread.cc @@ -44,8 +44,8 @@ bool GpuProcessLogMessageHandler(int severity, return false; } -ChildThread::Options GetOptions() { - ChildThread::Options options; +ChildThreadImpl::Options GetOptions() { + ChildThreadImpl::Options options; #if defined(USE_OZONE) IPC::MessageFilter* message_filter = ui::OzonePlatform::GetInstance() @@ -64,7 +64,7 @@ GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, bool dead_on_arrival, const gpu::GPUInfo& gpu_info, const DeferredMessages& deferred_messages) - : ChildThread(GetOptions()), + : ChildThreadImpl(GetOptions()), dead_on_arrival_(dead_on_arrival), gpu_info_(gpu_info), deferred_messages_(deferred_messages), @@ -77,7 +77,7 @@ GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, } GpuChildThread::GpuChildThread(const std::string& channel_id) - : ChildThread(Options(channel_id, false)), + : ChildThreadImpl(Options(channel_id, false)), dead_on_arrival_(false), in_browser_process_(true) { #if defined(OS_WIN) @@ -102,7 +102,7 @@ GpuChildThread::~GpuChildThread() { } void GpuChildThread::Shutdown() { - ChildThread::Shutdown(); + ChildThreadImpl::Shutdown(); logging::SetLogMessageHandler(NULL); } @@ -115,7 +115,7 @@ bool GpuChildThread::Send(IPC::Message* msg) { // process. This could result in deadlock. DCHECK(!msg->is_sync()); - return ChildThread::Send(msg); + return ChildThreadImpl::Send(msg); } bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h index b5c312d..7103cd3 100644 --- a/content/gpu/gpu_child_thread.h +++ b/content/gpu/gpu_child_thread.h @@ -14,7 +14,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "build/build_config.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/gpu/gpu_channel.h" #include "content/common/gpu/gpu_channel_manager.h" #include "content/common/gpu/gpu_config.h" @@ -33,7 +33,7 @@ class GpuWatchdogThread; // these per process. It does process initialization and shutdown. It forwards // IPC messages to GpuChannelManager, which is responsible for issuing rendering // commands to the GPU. -class GpuChildThread : public ChildThread { +class GpuChildThread : public ChildThreadImpl { public: typedef std::queue<IPC::Message*> DeferredMessages; diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc index 720a77b..a688902 100644 --- a/content/plugin/plugin_thread.cc +++ b/content/plugin/plugin_thread.cc @@ -106,7 +106,7 @@ void PluginThread::SetForcefullyTerminatePluginProcess() { } void PluginThread::Shutdown() { - ChildThread::Shutdown(); + ChildThreadImpl::Shutdown(); if (preloaded_plugin_module_) { base::UnloadNativeLibrary(preloaded_plugin_module_); diff --git a/content/plugin/plugin_thread.h b/content/plugin/plugin_thread.h index 11acafc..8ad115e 100644 --- a/content/plugin/plugin_thread.h +++ b/content/plugin/plugin_thread.h @@ -8,7 +8,7 @@ #include "base/files/file_path.h" #include "base/native_library.h" #include "build/build_config.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/npapi/plugin_lib.h" #include "content/plugin/plugin_channel.h" @@ -22,7 +22,7 @@ class BlinkPlatformImpl; // The PluginThread class represents a background thread where plugin instances // live. Communication occurs between WebPluginDelegateProxy in the renderer // process and WebPluginDelegateStub in this thread through IPC messages. -class PluginThread : public ChildThread { +class PluginThread : public ChildThreadImpl { public: PluginThread(); ~PluginThread() override; diff --git a/content/ppapi_plugin/ppapi_blink_platform_impl.cc b/content/ppapi_plugin/ppapi_blink_platform_impl.cc index ad84196..793f6d6 100644 --- a/content/ppapi_plugin/ppapi_blink_platform_impl.cc +++ b/content/ppapi_plugin/ppapi_blink_platform_impl.cc @@ -10,7 +10,7 @@ #include "base/strings/string16.h" #include "base/threading/platform_thread.h" #include "build/build_config.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/child_process_messages.h" #include "ppapi/proxy/plugin_globals.h" #include "ppapi/shared_impl/proxy_lock.h" diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc index 6d77afe..103a7b8 100644 --- a/content/ppapi_plugin/ppapi_thread.cc +++ b/content/ppapi_plugin/ppapi_thread.cc @@ -42,12 +42,10 @@ #include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/resource_reply_thread_registrar.h" -#include "ppapi/shared_impl/proxy_lock.h" #include "third_party/WebKit/public/web/WebKit.h" #include "ui/base/ui_base_switches.h" #if defined(OS_WIN) -#include "base/win/iat_patch_function.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" #include "sandbox/win/src/sandbox.h" @@ -94,54 +92,6 @@ static void WarmupWindowsLocales(const ppapi::PpapiPermissions& permissions) { } } -// TODO(scottmg): http://crbug.com/448473. This code should be removed from the -// renderer once PDF is always OOP and/or PDF is made to use Skia instead of GDI -// directly. -const wchar_t kPdfFileName[] = L"pdf.dll"; - -static base::win::IATPatchFunction g_iat_patch_createdca; -HDC WINAPI CreateDCAPatch(LPCSTR driver_name, - LPCSTR device_name, - LPCSTR output, - const void* init_data) { - DCHECK(std::string("DISPLAY") == std::string(driver_name)); - DCHECK(!device_name); - DCHECK(!output); - DCHECK(!init_data); - - // CreateDC fails behind the sandbox, but not CreateCompatibleDC. - return CreateCompatibleDC(NULL); -} - -static base::win::IATPatchFunction g_iat_patch_get_font_data; -DWORD WINAPI GetFontDataPatch(HDC hdc, - DWORD table, - DWORD offset, - LPVOID buffer, - DWORD length) { - int rv = GetFontData(hdc, table, offset, buffer, length); - if (rv == GDI_ERROR && hdc) { - HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); - - LOGFONT logfont; - if (GetObject(font, sizeof(LOGFONT), &logfont)) { - std::vector<char> font_data; - { - ppapi::ProxyAutoLock lock; - // In the sandbox, font loading will fail. We ask the browser to load it - // which causes it to be loaded by the kernel, which then makes the - // subsequent call succeed. - ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash( - reinterpret_cast<const void*>(&logfont)); - } - rv = GetFontData(hdc, table, offset, buffer, length); - } - } - return rv; -} - -#else -extern void* g_target_services; #endif namespace content { @@ -173,7 +123,7 @@ PpapiThread::~PpapiThread() { } void PpapiThread::Shutdown() { - ChildThread::Shutdown(); + ChildThreadImpl::Shutdown(); ppapi::proxy::PluginGlobals::Get()->ResetPluginProxyDelegate(); if (plugin_entry_points_.shutdown_module) @@ -185,7 +135,7 @@ void PpapiThread::Shutdown() { bool PpapiThread::Send(IPC::Message* msg) { // Allow access from multiple threads. if (base::MessageLoop::current() == message_loop()) - return ChildThread::Send(msg); + return ChildThreadImpl::Send(msg); return sync_message_filter()->Send(msg); } @@ -207,7 +157,7 @@ bool PpapiThread::OnControlMessageReceived(const IPC::Message& msg) { } void PpapiThread::OnChannelConnected(int32 peer_pid) { - ChildThread::OnChannelConnected(peer_pid); + ChildThreadImpl::OnChannelConnected(peer_pid); #if defined(OS_WIN) if (is_broker_) peer_handle_.Set(::OpenProcess(PROCESS_DUP_HANDLE, FALSE, peer_pid)); @@ -253,8 +203,7 @@ std::string PpapiThread::GetUILanguage() { void PpapiThread::PreCacheFont(const void* logfontw) { #if defined(OS_WIN) - Send(new ChildProcessHostMsg_PreCacheFont( - *static_cast<const LOGFONTW*>(logfontw))); + ChildThreadImpl::PreCacheFont(*static_cast<const LOGFONTW*>(logfontw)); #endif } @@ -374,15 +323,6 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path, // otherwise these would be silent terminations and fly under the radar). base::win::SetAbortBehaviorForCrashReporting(); - // Need to patch a few functions for font loading to work correctly. This can - // be removed once we switch PDF to use Skia. - if (GetModuleHandle(kPdfFileName)) { - g_iat_patch_createdca.Patch(kPdfFileName, "gdi32.dll", "CreateDCA", - CreateDCAPatch); - g_iat_patch_get_font_data.Patch(kPdfFileName, "gdi32.dll", "GetFontData", - GetFontDataPatch); - } - // Once we lower the token the sandbox is locked down and no new modules // can be loaded. TODO(cpu): consider changing to the loading style of // regular plugins. diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h index 3d80e49..8b4f522 100644 --- a/content/ppapi_plugin/ppapi_thread.h +++ b/content/ppapi_plugin/ppapi_thread.h @@ -14,7 +14,7 @@ #include "base/process/process.h" #include "base/scoped_native_library.h" #include "build/build_config.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/public/common/pepper_plugin_info.h" #include "ppapi/c/pp_module.h" #include "ppapi/c/trusted/ppp_broker.h" @@ -40,7 +40,13 @@ namespace content { class PpapiBlinkPlatformImpl; -class PpapiThread : public ChildThread, +#if defined(COMPILER_MSVC) +// See explanation for other RenderViewHostImpl which is the same issue. +#pragma warning(push) +#pragma warning(disable: 4250) +#endif + +class PpapiThread : public ChildThreadImpl, public ppapi::proxy::PluginDispatcher::PluginDelegate, public ppapi::proxy::PluginProxyDelegate { public: @@ -158,6 +164,10 @@ class PpapiThread : public ChildThread, DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); }; +#if defined(COMPILER_MSVC) +#pragma warning(pop) +#endif + } // namespace content #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ diff --git a/content/public/child/child_thread.h b/content/public/child/child_thread.h new file mode 100644 index 0000000..e3df72c --- /dev/null +++ b/content/public/child/child_thread.h @@ -0,0 +1,37 @@ +// Copyright 2015 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_PUBLIC_CHILD_THREAD_H_ +#define CONTENT_PUBLIC_CHILD_THREAD_H_ + +#include "content/common/content_export.h" +#include "ipc/ipc_sender.h" + +#if defined(OS_WIN) +#include <windows.h> +#endif + +namespace content { + +class CONTENT_EXPORT ChildThread : public IPC::Sender { + public: + // Returns the one child thread for this process. Note that this can only be + // accessed when running on the child thread itself. + static ChildThread* Get(); + + ~ChildThread() override {} + +#if defined(OS_WIN) + // Request that the given font be loaded by the browser so it's cached by the + // OS. Please see ChildProcessHost::PreCacheFont for details. + virtual void PreCacheFont(const LOGFONT& log_font) = 0; + + // Release cached font. + virtual void ReleaseCachedFonts() = 0; +#endif +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_CHILD_THREAD_H_ diff --git a/content/public/renderer/DEPS b/content/public/renderer/DEPS index 36c27b9..f78d4a3 100644 --- a/content/public/renderer/DEPS +++ b/content/public/renderer/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+content/public/child", "+media/base", "+media/filters", "+media/video", diff --git a/content/public/renderer/render_thread.h b/content/public/renderer/render_thread.h index 002f45d..407128b 100644 --- a/content/public/renderer/render_thread.h +++ b/content/public/renderer/render_thread.h @@ -10,12 +10,8 @@ #include "base/memory/shared_memory.h" #include "base/metrics/user_metrics_action.h" #include "content/common/content_export.h" +#include "content/public/child/child_thread.h" #include "ipc/ipc_channel_proxy.h" -#include "ipc/ipc_sender.h" - -#if defined(OS_WIN) -#include <windows.h> -#endif class GURL; @@ -45,7 +41,7 @@ class RenderProcessObserver; class ResourceDispatcherDelegate; class ServiceRegistry; -class CONTENT_EXPORT RenderThread : public IPC::Sender { +class CONTENT_EXPORT RenderThread : virtual public ChildThread { public: // Returns the one render thread for this process. Note that this can only // be accessed when running on the render thread itself. @@ -135,15 +131,6 @@ class CONTENT_EXPORT RenderThread : public IPC::Sender { // Gets the shutdown event for the process. virtual base::WaitableEvent* GetShutdownEvent() = 0; -#if defined(OS_WIN) - // Request that the given font be loaded by the browser so it's cached by the - // OS. Please see ChildProcessHost::PreCacheFont for details. - virtual void PreCacheFont(const LOGFONT& log_font) = 0; - - // Release cached font. - virtual void ReleaseCachedFonts() = 0; -#endif - // Returns the ServiceRegistry for this thread. virtual ServiceRegistry* GetServiceRegistry() = 0; }; diff --git a/content/public/utility/DEPS b/content/public/utility/DEPS new file mode 100644 index 0000000..ad94e88 --- /dev/null +++ b/content/public/utility/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+content/public/child", +] diff --git a/content/public/utility/utility_thread.h b/content/public/utility/utility_thread.h index 6e7cbd1..42bf10c 100644 --- a/content/public/utility/utility_thread.h +++ b/content/public/utility/utility_thread.h @@ -6,16 +6,11 @@ #define CONTENT_PUBLIC_UTILITY_UTILITY_THREAD_H_ #include "base/basictypes.h" -#include "content/common/content_export.h" -#include "ipc/ipc_sender.h" - -#if defined(OS_WIN) -#include <windows.h> -#endif +#include "content/public/child/child_thread.h" namespace content { -class CONTENT_EXPORT UtilityThread : public IPC::Sender { +class CONTENT_EXPORT UtilityThread : virtual public ChildThread { public: // Returns the one utility thread for this process. Note that this can only // be accessed when running on the utility thread itself. @@ -26,15 +21,6 @@ class CONTENT_EXPORT UtilityThread : public IPC::Sender { // Releases the process if we are not (or no longer) in batch mode. virtual void ReleaseProcessIfNeeded() = 0; - -#if defined(OS_WIN) - // Request that the given font be loaded by the browser so it's cached by the - // OS. Please see ChildProcessHost::PreCacheFont for details. - virtual void PreCacheFont(const LOGFONT& log_font) = 0; - - // Release cached font. - virtual void ReleaseCachedFonts() = 0; -#endif }; } // namespace content diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc index ce56f8e..65b85a1 100644 --- a/content/renderer/geolocation_dispatcher.cc +++ b/content/renderer/geolocation_dispatcher.cc @@ -4,7 +4,6 @@ #include "content/renderer/geolocation_dispatcher.h" -#include "content/child/child_thread.h" #include "content/public/common/geoposition.h" #include "content/renderer/render_view_impl.h" #include "third_party/WebKit/public/platform/WebString.h" diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc index 9c24682..66f3d28 100644 --- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc +++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc @@ -8,7 +8,7 @@ #include <GLES2/gl2ext.h> #include "base/bind.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/gpu/client/context_provider_command_buffer.h" #include "content/common/gpu/client/gl_helper.h" #include "content/common/gpu/client/gpu_channel_host.h" @@ -48,7 +48,7 @@ RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories( : task_runner_(task_runner), gpu_channel_host_(gpu_channel_host), context_provider_(context_provider), - thread_safe_sender_(ChildThread::current()->thread_safe_sender()) {} + thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {} @@ -239,7 +239,7 @@ scoped_ptr<base::SharedMemory> RendererGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) { DCHECK(task_runner_->BelongsToCurrentThread()); scoped_ptr<base::SharedMemory> mem( - ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get())); + ChildThreadImpl::AllocateSharedMemory(size, thread_safe_sender_.get())); if (mem && !mem->Map(size)) return nullptr; return mem; diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc index ffa2536..0bfc9d8 100644 --- a/content/renderer/media/rtc_video_decoder.cc +++ b/content/renderer/media/rtc_video_decoder.cc @@ -13,7 +13,6 @@ #include "base/stl_util.h" #include "base/synchronization/waitable_event.h" #include "base/task_runner_util.h" -#include "content/child/child_thread.h" #include "content/renderer/media/native_handle_impl.h" #include "gpu/command_buffer/common/mailbox_holder.h" #include "media/base/bind_to_current_loop.h" diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc index 32cac5d..66bc362 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.cc +++ b/content/renderer/npapi/webplugin_delegate_proxy.cc @@ -640,7 +640,7 @@ bool WebPluginDelegateProxy::CreateLocalBitmap( bool WebPluginDelegateProxy::CreateSharedBitmap( scoped_ptr<SharedMemoryBitmap>* memory, scoped_ptr<skia::PlatformCanvas>* canvas) { - *memory = ChildThread::current() + *memory = ChildThreadImpl::current() ->shared_bitmap_manager() ->AllocateSharedMemoryBitmap(plugin_rect_.size()); if (!memory->get()) diff --git a/content/renderer/pepper/pepper_compositor_host.cc b/content/renderer/pepper/pepper_compositor_host.cc index c5f5e98..eec292a 100644 --- a/content/renderer/pepper/pepper_compositor_host.cc +++ b/content/renderer/pepper/pepper_compositor_host.cc @@ -12,7 +12,7 @@ #include "cc/resources/texture_mailbox.h" #include "cc/trees/layer_tree_host.h" #include "content/child/child_shared_bitmap_manager.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/public/renderer/renderer_ppapi_host.h" #include "content/renderer/pepper/gfx_conversion.h" #include "content/renderer/pepper/host_globals.h" @@ -288,7 +288,7 @@ void PepperCompositorHost::UpdateLayer( DCHECK_EQ(desc.stride, desc.size.width * 4); DCHECK_EQ(desc.format, PP_IMAGEDATAFORMAT_RGBA_PREMUL); scoped_ptr<cc::SharedBitmap> bitmap = - ChildThread::current() + ChildThreadImpl::current() ->shared_bitmap_manager() ->GetBitmapForSharedMemory(image_shm.get()); diff --git a/content/renderer/pepper/pepper_file_system_host.cc b/content/renderer/pepper/pepper_file_system_host.cc index 6994534..bce63a2 100644 --- a/content/renderer/pepper/pepper_file_system_host.cc +++ b/content/renderer/pepper/pepper_file_system_host.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/callback.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/fileapi/file_system_dispatcher.h" #include "content/common/pepper_file_util.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" @@ -102,7 +102,7 @@ int32_t PepperFileSystemHost::OnHostMsgOpen( return PP_ERROR_FAILED; FileSystemDispatcher* file_system_dispatcher = - ChildThread::current()->file_system_dispatcher(); + ChildThreadImpl::current()->file_system_dispatcher(); reply_context_ = context->MakeReplyMessageContext(); file_system_dispatcher->OpenFileSystem( document_url.GetOrigin(), diff --git a/content/renderer/pepper/ppb_broker_impl.cc b/content/renderer/pepper/ppb_broker_impl.cc index 33181a25..ead54a0 100644 --- a/content/renderer/pepper/ppb_broker_impl.cc +++ b/content/renderer/pepper/ppb_broker_impl.cc @@ -32,7 +32,7 @@ PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) connect_callback_(), pipe_handle_(PlatformFileToInt(base::SyncSocket::kInvalidHandle)), routing_id_(RenderThreadImpl::current()->GenerateRoutingID()) { - ChildThread::current()->GetRouter()->AddRoute(routing_id_, this); + ChildThreadImpl::current()->GetRouter()->AddRoute(routing_id_, this); } PPB_Broker_Impl::~PPB_Broker_Impl() { @@ -43,7 +43,7 @@ PPB_Broker_Impl::~PPB_Broker_Impl() { // The plugin owns the handle. pipe_handle_ = PlatformFileToInt(base::SyncSocket::kInvalidHandle); - ChildThread::current()->GetRouter()->RemoveRoute(routing_id_); + ChildThreadImpl::current()->GetRouter()->RemoveRoute(routing_id_); } PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { return this; } diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 876e8ae..9ad8d4f 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -2041,13 +2041,13 @@ blink::WebServiceWorkerProvider* RenderFrameImpl::createServiceWorkerProvider( DCHECK(!frame_ || frame_ == frame); // At this point we should have non-null data source. DCHECK(frame->dataSource()); - if (!ChildThread::current()) + if (!ChildThreadImpl::current()) return NULL; // May be null in some tests. ServiceWorkerNetworkProvider* provider = ServiceWorkerNetworkProvider::FromDocumentState( DocumentState::FromDataSource(frame->dataSource())); return new WebServiceWorkerProviderImpl( - ChildThread::current()->thread_safe_sender(), + ChildThreadImpl::current()->thread_safe_sender(), provider ? provider->context() : NULL); } @@ -3362,7 +3362,7 @@ void RenderFrameImpl::requestStorageQuota( callbacks.didFail(blink::WebStorageQuotaErrorAbort); return; } - ChildThread::current()->quota_dispatcher()->RequestStorageQuota( + ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( render_view_->GetRoutingID(), GURL(origin.toString()), static_cast<storage::StorageType>(type), diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 2914c9c..533f950 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -282,8 +282,8 @@ void AddHistogramSample(void* hist, int sample) { scoped_ptr<cc::SharedBitmap> AllocateSharedBitmapFunction( const gfx::Size& size) { - return ChildThread::current()->shared_bitmap_manager()->AllocateSharedBitmap( - size); + return ChildThreadImpl::current()->shared_bitmap_manager()-> + AllocateSharedBitmap(size); } void EnableBlinkPlatformLogChannels(const std::string& channels) { @@ -423,18 +423,18 @@ RenderThreadImpl* RenderThreadImpl::current() { // When we run plugins in process, we actually run them on the render thread, // which means that we need to make the render thread pump UI events. RenderThreadImpl::RenderThreadImpl() - : ChildThread(Options(ShouldUseMojoChannel())) { + : ChildThreadImpl(Options(ShouldUseMojoChannel())) { Init(); } RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) - : ChildThread(Options(channel_name, ShouldUseMojoChannel())) { + : ChildThreadImpl(Options(channel_name, ShouldUseMojoChannel())) { Init(); } RenderThreadImpl::RenderThreadImpl( scoped_ptr<base::MessageLoop> main_message_loop) - : ChildThread(Options(ShouldUseMojoChannel())), + : ChildThreadImpl(Options(ShouldUseMojoChannel())), main_message_loop_(main_message_loop.Pass()) { Init(); } @@ -655,7 +655,7 @@ void RenderThreadImpl::Init() { } base::DiscardableMemoryShmemAllocator::SetInstance( - ChildThread::discardable_shared_memory_manager()); + ChildThreadImpl::discardable_shared_memory_manager()); service_registry()->AddService<RenderFrameSetup>( base::Bind(CreateRenderFrameSetup)); @@ -670,7 +670,7 @@ void RenderThreadImpl::Shutdown() { FOR_EACH_OBSERVER( RenderProcessObserver, observers_, OnRenderProcessShutdown()); - ChildThread::Shutdown(); + ChildThreadImpl::Shutdown(); if (memory_observer_) { message_loop()->RemoveTaskObserver(memory_observer_.get()); @@ -811,7 +811,7 @@ bool RenderThreadImpl::Send(IPC::Message* msg) { #endif } - bool rv = ChildThread::Send(msg); + bool rv = ChildThreadImpl::Send(msg); if (pumping_events) { #if defined(ENABLE_PLUGINS) @@ -860,7 +860,7 @@ scoped_refptr<base::MessageLoopProxy> } void RenderThreadImpl::AddRoute(int32 routing_id, IPC::Listener* listener) { - ChildThread::GetRouter()->AddRoute(routing_id, listener); + ChildThreadImpl::GetRouter()->AddRoute(routing_id, listener); PendingRenderFrameConnectMap::iterator it = pending_render_frame_connects_.find(routing_id); if (it == pending_render_frame_connects_.end()) @@ -881,7 +881,7 @@ void RenderThreadImpl::AddRoute(int32 routing_id, IPC::Listener* listener) { } void RenderThreadImpl::RemoveRoute(int32 routing_id) { - ChildThread::GetRouter()->RemoveRoute(routing_id); + ChildThreadImpl::GetRouter()->RemoveRoute(routing_id); } void RenderThreadImpl::AddEmbeddedWorkerRoute(int32 routing_id, @@ -1112,7 +1112,7 @@ void RenderThreadImpl::RecordComputedAction(const std::string& action) { scoped_ptr<base::SharedMemory> RenderThreadImpl::HostAllocateSharedMemoryBuffer(size_t size) { - return ChildThread::AllocateSharedMemory(size, thread_safe_sender()); + return ChildThreadImpl::AllocateSharedMemory(size, thread_safe_sender()); } cc::SharedBitmapManager* RenderThreadImpl::GetSharedBitmapManager() { @@ -1326,14 +1326,6 @@ void RenderThreadImpl::PreCacheFontCharacters(const LOGFONT& log_font, Send(new ViewHostMsg_PreCacheFontCharacters(log_font, str)); } -void RenderThreadImpl::PreCacheFont(const LOGFONT& log_font) { - Send(new ChildProcessHostMsg_PreCacheFont(log_font)); -} - -void RenderThreadImpl::ReleaseCachedFonts() { - Send(new ChildProcessHostMsg_ReleaseCachedFonts()); -} - #endif // OS_WIN ServiceRegistry* RenderThreadImpl::GetServiceRegistry() { diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index e204c63..18ceb7b 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -18,7 +18,7 @@ #include "base/threading/thread_checker.h" #include "base/timer/timer.h" #include "build/build_config.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/content_export.h" #include "content/common/frame_replication_state.h" #include "content/common/gpu/client/gpu_channel_host.h" @@ -110,6 +110,12 @@ class VideoCaptureImplManager; class WebGraphicsContext3DCommandBufferImpl; class WebRTCIdentityService; +#if defined(COMPILER_MSVC) +// See explanation for other RenderViewHostImpl which is the same issue. +#pragma warning(push) +#pragma warning(disable: 4250) +#endif + // The RenderThreadImpl class represents a background thread where RenderView // instances live. The RenderThread supports an API that is used by its // consumer to talk indirectly to the RenderViews and supporting objects. @@ -121,7 +127,7 @@ class WebRTCIdentityService; // The routing IDs correspond to RenderView instances. class CONTENT_EXPORT RenderThreadImpl : public RenderThread, - public ChildThread, + public ChildThreadImpl, public GpuChannelHostFactory, NON_EXPORTED_BASE(public CompositorDependencies) { public: @@ -175,10 +181,6 @@ class CONTENT_EXPORT RenderThreadImpl int PostTaskToAllWebWorkers(const base::Closure& closure) override; bool ResolveProxy(const GURL& url, std::string* proxy_list) override; base::WaitableEvent* GetShutdownEvent() override; -#if defined(OS_WIN) - virtual void PreCacheFont(const LOGFONT& log_font) override; - virtual void ReleaseCachedFonts() override; -#endif ServiceRegistry* GetServiceRegistry() override; // CompositorDependencies implementation. @@ -625,6 +627,10 @@ class CONTENT_EXPORT RenderThreadImpl DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); }; +#if defined(COMPILER_MSVC) +#pragma warning(pop) +#endif + } // namespace content #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ diff --git a/content/renderer/render_thread_impl_browsertest.cc b/content/renderer/render_thread_impl_browsertest.cc index 3e4a795..39bf764 100644 --- a/content/renderer/render_thread_impl_browsertest.cc +++ b/content/renderer/render_thread_impl_browsertest.cc @@ -77,6 +77,12 @@ class TestTaskCounter : public base::SingleThreadTaskRunner { int count_; }; +#if defined(COMPILER_MSVC) +// See explanation for other RenderViewHostImpl which is the same issue. +#pragma warning(push) +#pragma warning(disable: 4250) +#endif + class RenderThreadImplForTest : public RenderThreadImpl { public: RenderThreadImplForTest(const std::string& channel_id, @@ -91,12 +97,16 @@ class RenderThreadImplForTest : public RenderThreadImpl { RenderThreadImpl::SetResourceDispatchTaskQueue(test_task_counter_); } - using ChildThread::OnMessageReceived; + using ChildThreadImpl::OnMessageReceived; private: scoped_refptr<TestTaskCounter> test_task_counter_; }; +#if defined(COMPILER_MSVC) +#pragma warning(pop) +#endif + void QuitTask(base::MessageLoop* message_loop) { message_loop->QuitWhenIdle(); } diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 3be3eb3..8831340 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -35,7 +35,6 @@ #include "content/child/appcache/appcache_dispatcher.h" #include "content/child/appcache/web_application_cache_host_impl.h" #include "content/child/child_shared_bitmap_manager.h" -#include "content/child/child_thread.h" #include "content/child/npapi/webplugin_delegate_impl.h" #include "content/child/request_extra_data.h" #include "content/child/webmessageportchannel_impl.h" diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index 2894dc6..1fcf5bf 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc @@ -245,10 +245,10 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( } // ChildThread may not exist in some tests. - if (ChildThread::current()) { - sync_message_filter_ = ChildThread::current()->sync_message_filter(); - thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); - quota_message_filter_ = ChildThread::current()->quota_message_filter(); + if (ChildThreadImpl::current()) { + sync_message_filter_ = ChildThreadImpl::current()->sync_message_filter(); + thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); + quota_message_filter_ = ChildThreadImpl::current()->quota_message_filter(); blob_registry_.reset(new WebBlobRegistryImpl(thread_safe_sender_.get())); web_idb_factory_.reset(new WebIDBFactoryImpl(thread_safe_sender_.get())); web_database_observer_impl_.reset( diff --git a/content/renderer/renderer_clipboard_delegate.cc b/content/renderer/renderer_clipboard_delegate.cc index b8d0b0c..0ed03f6 100644 --- a/content/renderer/renderer_clipboard_delegate.cc +++ b/content/renderer/renderer_clipboard_delegate.cc @@ -143,7 +143,7 @@ bool RendererClipboardDelegate::WriteImage(ui::ClipboardType clipboard_type, // Allocate a shared memory buffer to hold the bitmap bits. uint32 buf_size = checked_buf_size.ValueOrDie(); - shared_buf = ChildThread::current()->AllocateSharedMemory(buf_size); + shared_buf = ChildThreadImpl::current()->AllocateSharedMemory(buf_size); if (!shared_buf) return false; if (!shared_buf->Map(buf_size)) diff --git a/content/renderer/service_worker/embedded_worker_context_client.cc b/content/renderer/service_worker/embedded_worker_context_client.cc index d04fc06..2c50e5c 100644 --- a/content/renderer/service_worker/embedded_worker_context_client.cc +++ b/content/renderer/service_worker/embedded_worker_context_client.cc @@ -103,7 +103,7 @@ EmbeddedWorkerContextClient::EmbeddedWorkerContextClient( service_worker_scope_(service_worker_scope), script_url_(script_url), worker_devtools_agent_route_id_(worker_devtools_agent_route_id), - sender_(ChildThread::current()->thread_safe_sender()), + sender_(ChildThreadImpl::current()->thread_safe_sender()), main_thread_proxy_(base::MessageLoopProxy::current()), weak_factory_(this) { TRACE_EVENT_ASYNC_BEGIN0("ServiceWorker", diff --git a/content/renderer/service_worker/embedded_worker_context_message_filter.cc b/content/renderer/service_worker/embedded_worker_context_message_filter.cc index cbc141d..4999b38 100644 --- a/content/renderer/service_worker/embedded_worker_context_message_filter.cc +++ b/content/renderer/service_worker/embedded_worker_context_message_filter.cc @@ -5,7 +5,7 @@ #include "content/renderer/service_worker/embedded_worker_context_message_filter.h" #include "base/message_loop/message_loop_proxy.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/child/thread_safe_sender.h" #include "content/child/worker_thread_task_runner.h" #include "content/renderer/service_worker/embedded_worker_context_client.h" @@ -15,7 +15,7 @@ namespace content { EmbeddedWorkerContextMessageFilter::EmbeddedWorkerContextMessageFilter() : main_thread_loop_proxy_(base::MessageLoopProxy::current()), - thread_safe_sender_(ChildThread::current()->thread_safe_sender()) {} + thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} EmbeddedWorkerContextMessageFilter::~EmbeddedWorkerContextMessageFilter() {} diff --git a/content/renderer/service_worker/embedded_worker_devtools_agent.cc b/content/renderer/service_worker/embedded_worker_devtools_agent.cc index 791a2ca..e1c640a 100644 --- a/content/renderer/service_worker/embedded_worker_devtools_agent.cc +++ b/content/renderer/service_worker/embedded_worker_devtools_agent.cc @@ -4,7 +4,6 @@ #include "content/renderer/service_worker/embedded_worker_devtools_agent.h" -#include "content/child/child_thread.h" #include "content/common/devtools_messages.h" #include "content/renderer/render_thread_impl.h" #include "third_party/WebKit/public/platform/WebCString.h" diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.cc b/content/renderer/shared_worker/embedded_shared_worker_stub.cc index d026cec..121831f 100644 --- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc @@ -168,7 +168,7 @@ blink::WebWorkerPermissionClientProxy* GURL(origin.toString()), origin.isUnique(), route_id_, - ChildThread::current()->thread_safe_sender()); + ChildThreadImpl::current()->thread_safe_sender()); } void EmbeddedSharedWorkerStub::sendDevToolsMessage( diff --git a/content/renderer/shared_worker_repository.cc b/content/renderer/shared_worker_repository.cc index a883464..46dcb91 100644 --- a/content/renderer/shared_worker_repository.cc +++ b/content/renderer/shared_worker_repository.cc @@ -4,7 +4,7 @@ #include "content/renderer/shared_worker_repository.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/view_messages.h" #include "content/renderer/render_frame_impl.h" #include "content/renderer/websharedworker_proxy.h" @@ -39,7 +39,7 @@ SharedWorkerRepository::createSharedWorkerConnector( if (route_id == MSG_ROUTING_NONE) return NULL; documents_with_workers_.insert(document_id); - return new WebSharedWorkerProxy(ChildThread::current()->GetRouter(), + return new WebSharedWorkerProxy(ChildThreadImpl::current()->GetRouter(), document_id, route_id, params.render_frame_route_id); diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index 32f9814..26af2b1 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -40,7 +40,7 @@ UtilityThreadImpl::UtilityThreadImpl() : single_process_(false) { } UtilityThreadImpl::UtilityThreadImpl(const std::string& channel_name) - : ChildThread(Options(channel_name, false)), + : ChildThreadImpl(Options(channel_name, false)), single_process_(true) { Init(); } @@ -49,16 +49,12 @@ UtilityThreadImpl::~UtilityThreadImpl() { } void UtilityThreadImpl::Shutdown() { - ChildThread::Shutdown(); + ChildThreadImpl::Shutdown(); if (!single_process_) blink::shutdown(); } -bool UtilityThreadImpl::Send(IPC::Message* msg) { - return ChildThread::Send(msg); -} - void UtilityThreadImpl::ReleaseProcessIfNeeded() { if (batch_mode_) return; @@ -74,18 +70,6 @@ void UtilityThreadImpl::ReleaseProcessIfNeeded() { } } -#if defined(OS_WIN) - -void UtilityThreadImpl::PreCacheFont(const LOGFONT& log_font) { - Send(new ChildProcessHostMsg_PreCacheFont(log_font)); -} - -void UtilityThreadImpl::ReleaseCachedFonts() { - Send(new ChildProcessHostMsg_ReleaseCachedFonts()); -} - -#endif // OS_WIN - void UtilityThreadImpl::Init() { batch_mode_ = false; ChildProcess::current()->AddRefProcess(); diff --git a/content/utility/utility_thread_impl.h b/content/utility/utility_thread_impl.h index 5b186fc..043aea9 100644 --- a/content/utility/utility_thread_impl.h +++ b/content/utility/utility_thread_impl.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "content/child/child_thread.h" +#include "content/child/child_thread_impl.h" #include "content/common/content_export.h" #include "content/public/utility/utility_thread.h" @@ -21,9 +21,15 @@ class FilePath; namespace content { class BlinkPlatformImpl; +#if defined(COMPILER_MSVC) +// See explanation for other RenderViewHostImpl which is the same issue. +#pragma warning(push) +#pragma warning(disable: 4250) +#endif + // This class represents the background thread where the utility task runs. class UtilityThreadImpl : public UtilityThread, - public ChildThread { + public ChildThreadImpl { public: UtilityThreadImpl(); // Constructor that's used when running in single process mode. @@ -31,12 +37,7 @@ class UtilityThreadImpl : public UtilityThread, ~UtilityThreadImpl() override; void Shutdown() override; - bool Send(IPC::Message* msg) override; void ReleaseProcessIfNeeded() override; -#if defined(OS_WIN) - virtual void PreCacheFont(const LOGFONT& log_font) override; - virtual void ReleaseCachedFonts() override; -#endif private: void Init(); @@ -63,6 +64,10 @@ class UtilityThreadImpl : public UtilityThread, DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl); }; +#if defined(COMPILER_MSVC) +#pragma warning(pop) +#endif + } // namespace content #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ |