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

Side by Side Diff: content/browser/utility_process_host_impl.cc

Issue 865543002: WIP: Browser image decoding using Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and add DecodeImageBase64. Created 5 years, 11 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
« no previous file with comments | « content/browser/utility_process_host_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/utility_process_host_impl.h" 5 #include "content/browser/utility_process_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/process/process_handle.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
16 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
17 #include "content/browser/browser_child_process_host_impl.h" 18 #include "content/browser/browser_child_process_host_impl.h"
19 #include "content/browser/mojo/mojo_application_host.h"
18 #include "content/browser/renderer_host/render_process_host_impl.h" 20 #include "content/browser/renderer_host/render_process_host_impl.h"
19 #include "content/common/child_process_host_impl.h" 21 #include "content/common/child_process_host_impl.h"
20 #include "content/common/utility_messages.h" 22 #include "content/common/utility_messages.h"
21 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/content_browser_client.h" 24 #include "content/public/browser/content_browser_client.h"
23 #include "content/public/browser/utility_process_host_client.h" 25 #include "content/public/browser/utility_process_host_client.h"
24 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
25 #include "content/public/common/process_type.h" 27 #include "content/public/common/process_type.h"
26 #include "content/public/common/sandboxed_process_launcher_delegate.h" 28 #include "content/public/common/sandboxed_process_launcher_delegate.h"
27 #include "ipc/ipc_switches.h" 29 #include "ipc/ipc_switches.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 161 }
160 162
161 #if defined(OS_POSIX) 163 #if defined(OS_POSIX)
162 164
163 void UtilityProcessHostImpl::SetEnv(const base::EnvironmentMap& env) { 165 void UtilityProcessHostImpl::SetEnv(const base::EnvironmentMap& env) {
164 env_ = env; 166 env_ = env;
165 } 167 }
166 168
167 #endif // OS_POSIX 169 #endif // OS_POSIX
168 170
171 bool UtilityProcessHostImpl::StartMojoMode() {
172 mojo_application_host_.reset(new MojoApplicationHost);
173 mojo_application_host_->Init();
174 return StartProcess();
175 }
176
177 ServiceRegistry* UtilityProcessHostImpl::GetServiceRegistry() {
178 if (mojo_application_host_)
179 return mojo_application_host_->service_registry();
180
181 return nullptr;
182 }
183
169 bool UtilityProcessHostImpl::StartProcess() { 184 bool UtilityProcessHostImpl::StartProcess() {
170 if (started_) 185 if (started_)
171 return true; 186 return true;
172 started_ = true; 187 started_ = true;
173 188
174 if (is_batch_mode_) 189 if (is_batch_mode_)
175 return true; 190 return true;
176 191
177 // Name must be set or metrics_service will crash in any test which 192 // Name must be set or metrics_service will crash in any test which
178 // launches a UtilityProcessHost. 193 // launches a UtilityProcessHost.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { 305 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) {
291 if (!client_.get()) 306 if (!client_.get())
292 return; 307 return;
293 308
294 client_task_runner_->PostTask( 309 client_task_runner_->PostTask(
295 FROM_HERE, 310 FROM_HERE,
296 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), 311 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(),
297 exit_code)); 312 exit_code));
298 } 313 }
299 314
315 void UtilityProcessHostImpl::OnProcessLaunched() {
316 if (mojo_application_host_) {
317 base::ProcessHandle handle;
318 if (RenderProcessHost::run_renderer_in_process())
319 handle = base::GetCurrentProcessHandle();
320 else
321 handle = process_->GetData().handle;
322
323 mojo_application_host_->Activate(this, handle);
324 }
325 }
326
300 } // namespace content 327 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/utility_process_host_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698