Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/utility/utility_thread_impl.cc

Issue 1133563007: Adding WebThread and new BlinkPlatformImpl for utility thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing style. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/utility/utility_thread_impl.h" 5 #include "content/utility/utility_thread_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "content/child/blink_platform_impl.h" 11 #include "content/child/blink_platform_impl.h"
12 #include "content/child/child_process.h" 12 #include "content/child/child_process.h"
13 #include "content/common/child_process_messages.h" 13 #include "content/common/child_process_messages.h"
14 #include "content/common/utility_messages.h" 14 #include "content/common/utility_messages.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "content/public/utility/content_utility_client.h" 16 #include "content/public/utility/content_utility_client.h"
17 #include "content/utility/utility_blink_platform_impl.h"
17 #include "ipc/ipc_sync_channel.h" 18 #include "ipc/ipc_sync_channel.h"
18 #include "third_party/WebKit/public/web/WebKit.h" 19 #include "third_party/WebKit/public/web/WebKit.h"
19 20
20 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) 21 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS)
21 #include "base/files/file_path.h" 22 #include "base/files/file_path.h"
22 #include "content/common/plugin_list.h" 23 #include "content/common/plugin_list.h"
23 #endif 24 #endif
24 25
25 namespace content { 26 namespace content {
26 27
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 74 }
74 75
75 void UtilityThreadImpl::Init() { 76 void UtilityThreadImpl::Init() {
76 batch_mode_ = false; 77 batch_mode_ = false;
77 ChildProcess::current()->AddRefProcess(); 78 ChildProcess::current()->AddRefProcess();
78 if (!IsInBrowserProcess()) { 79 if (!IsInBrowserProcess()) {
79 // We can only initialize WebKit on one thread, and in single process mode 80 // We can only initialize WebKit on one thread, and in single process mode
80 // we run the utility thread on separate thread. This means that if any code 81 // we run the utility thread on separate thread. This means that if any code
81 // needs WebKit initialized in the utility process, they need to have 82 // needs WebKit initialized in the utility process, they need to have
82 // another path to support single process mode. 83 // another path to support single process mode.
83 blink_platform_impl_.reset(new BlinkPlatformImpl); 84 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl);
84 blink::initialize(blink_platform_impl_.get()); 85 blink::initialize(blink_platform_impl_.get());
85 } 86 }
86 GetContentClient()->utility()->UtilityThreadStarted(); 87 GetContentClient()->utility()->UtilityThreadStarted();
87 GetContentClient()->utility()->RegisterMojoServices(service_registry()); 88 GetContentClient()->utility()->RegisterMojoServices(service_registry());
88 } 89 }
89 90
90 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 91 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
91 if (GetContentClient()->utility()->OnMessageReceived(msg)) 92 if (GetContentClient()->utility()->OnMessageReceived(msg))
92 return true; 93 return true;
93 94
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); 129 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i]));
129 else 130 else
130 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); 131 Send(new UtilityHostMsg_LoadedPlugin(i, plugin));
131 } 132 }
132 133
133 ReleaseProcessIfNeeded(); 134 ReleaseProcessIfNeeded();
134 } 135 }
135 #endif 136 #endif
136 137
137 } // namespace content 138 } // namespace content
OLDNEW
« no previous file with comments | « content/utility/utility_thread_impl.h ('k') | content/utility/webthread_impl_for_utility_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698