diff options
-rw-r--r-- | chrome/common/child_thread.cc | 14 | ||||
-rw-r--r-- | chrome/common/child_thread.h | 7 | ||||
-rw-r--r-- | chrome/renderer/render_thread.cc | 7 | ||||
-rw-r--r-- | chrome/renderer/render_thread_unittest.cc | 4 |
4 files changed, 20 insertions, 12 deletions
diff --git a/chrome/common/child_thread.cc b/chrome/common/child_thread.cc index db3c4c5..1d1f071 100644 --- a/chrome/common/child_thread.cc +++ b/chrome/common/child_thread.cc @@ -14,13 +14,21 @@ #include "webkit/glue/webkit_glue.h" -ChildThread::ChildThread() - : check_with_browser_before_shutdown_(false), - message_loop_(MessageLoop::current()) { +ChildThread::ChildThread() { channel_name_ = WideToASCII( CommandLine::ForCurrentProcess()->GetSwitchValue( switches::kProcessChannelID)); + Init(); +} + +ChildThread::ChildThread(const std::string channel_name) + : channel_name_(channel_name) { + Init(); +} +void ChildThread::Init() { + check_with_browser_before_shutdown_ = false; + message_loop_ = MessageLoop::current(); if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { webkit_glue::SetUserAgent(WideToUTF8( CommandLine::ForCurrentProcess()->GetSwitchValue( diff --git a/chrome/common/child_thread.h b/chrome/common/child_thread.h index 86eae4c..a7074c7 100644 --- a/chrome/common/child_thread.h +++ b/chrome/common/child_thread.h @@ -19,6 +19,8 @@ class ChildThread : public IPC::Channel::Listener, public: // Creates the thread. ChildThread(); + // Used for single-process mode. + ChildThread(const std::string channel_name); virtual ~ChildThread(); // IPC::Message::Sender implementation: @@ -40,9 +42,6 @@ class ChildThread : public IPC::Channel::Listener, protected: friend class ChildProcess; - // Overrides the channel name. Used for --single-process mode. - void SetChannelName(const std::string& name) { channel_name_ = name; } - // Called when the process refcount is 0. void OnProcessFinalRelease(); @@ -51,6 +50,8 @@ class ChildThread : public IPC::Channel::Listener, IPC::SyncChannel* channel() { return channel_.get(); } private: + void Init(); + // IPC::Channel::Listener implementation: virtual void OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 7a5a8be..80811b2 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -87,14 +87,12 @@ class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter { // 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. -RenderThread::RenderThread() - : plugin_refresh_allowed_(true) { +RenderThread::RenderThread() { Init(); } RenderThread::RenderThread(const std::string& channel_name) - : plugin_refresh_allowed_(true) { - SetChannelName(channel_name); + : ChildThread(channel_name) { Init(); } @@ -107,6 +105,7 @@ void RenderThread::Init() { CoInitialize(0); #endif + plugin_refresh_allowed_ = true; cache_stats_factory_.reset( new ScopedRunnableMethodFactory<RenderThread>(this)); diff --git a/chrome/renderer/render_thread_unittest.cc b/chrome/renderer/render_thread_unittest.cc index 711cc42..aa370a5 100644 --- a/chrome/renderer/render_thread_unittest.cc +++ b/chrome/renderer/render_thread_unittest.cc @@ -40,11 +40,11 @@ class RenderThreadTest : public testing::Test { IPC::Channel *channel_; }; -TEST_F(RenderThreadTest, DISABLED_TestGlobal) { +TEST_F(RenderThreadTest, TestGlobal) { ASSERT_TRUE(RenderThread::current()); } -TEST_F(RenderThreadTest, DISABLED_TestVisitedMsg) { +TEST_F(RenderThreadTest, TestVisitedMsg) { #if defined(OS_WIN) IPC::Message* msg = new ViewMsg_VisitedLink_NewTable(NULL); #elif defined(OS_POSIX) |