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

Unified Diff: content/utility/utility_thread_impl.cc

Issue 1251823002: Initialize blink only when needed in utility processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/utility/utility_thread_impl.cc
diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc
index 00ebc6e6b908b9c63126dd899d618a6f469fd6e0..9e5e33ea574fab8764282a8965cfc305e705a03f 100644
--- a/content/utility/utility_thread_impl.cc
+++ b/content/utility/utility_thread_impl.cc
@@ -55,8 +55,8 @@ UtilityThreadImpl::~UtilityThreadImpl() {
void UtilityThreadImpl::Shutdown() {
ChildThreadImpl::Shutdown();
- if (!IsInBrowserProcess())
- blink::shutdown();
+ if (blink_platform_impl_)
+ blink::shutdownWithoutV8();
}
void UtilityThreadImpl::ReleaseProcessIfNeeded() {
@@ -74,17 +74,22 @@ void UtilityThreadImpl::ReleaseProcessIfNeeded() {
}
}
-void UtilityThreadImpl::Init() {
- batch_mode_ = false;
- ChildProcess::current()->AddRefProcess();
- if (!IsInBrowserProcess()) {
+void UtilityThreadImpl::EnsureBlinkInitialized() {
+ if (blink_platform_impl_ || IsInBrowserProcess()) {
// We can only initialize WebKit on one thread, and in single process mode
// we run the utility thread on separate thread. This means that if any code
// needs WebKit initialized in the utility process, they need to have
// another path to support single process mode.
- blink_platform_impl_.reset(new UtilityBlinkPlatformImpl);
- blink::initialize(blink_platform_impl_.get());
+ return;
}
+
+ blink_platform_impl_.reset(new UtilityBlinkPlatformImpl);
+ blink::initializeWithoutV8(blink_platform_impl_.get());
+}
+
+void UtilityThreadImpl::Init() {
+ batch_mode_ = false;
+ ChildProcess::current()->AddRefProcess();
GetContentClient()->utility()->UtilityThreadStarted();
process_control_.reset(new UtilityProcessControlImpl);

Powered by Google App Engine
This is Rietveld 408576698