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

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 940813003: Use a utility process for the Mojo v8 proxy resolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-pac-in-process-enable
Patch Set: Add browser test Created 5 years, 9 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 "chrome/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/common/chrome_utility_messages.h" 12 #include "chrome/common/chrome_utility_messages.h"
13 #include "chrome/common/safe_browsing/zip_analyzer.h" 13 #include "chrome/common/safe_browsing/zip_analyzer.h"
14 #include "chrome/utility/chrome_content_utility_ipc_whitelist.h" 14 #include "chrome/utility/chrome_content_utility_ipc_whitelist.h"
15 #include "chrome/utility/utility_message_handler.h" 15 #include "chrome/utility/utility_message_handler.h"
16 #include "content/public/child/image_decoder_utils.h" 16 #include "content/public/child/image_decoder_utils.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "content/public/common/service_registry.h"
18 #include "content/public/utility/utility_thread.h" 19 #include "content/public/utility/utility_thread.h"
19 #include "courgette/courgette.h" 20 #include "courgette/courgette.h"
20 #include "courgette/third_party/bsdiff.h" 21 #include "courgette/third_party/bsdiff.h"
21 #include "ipc/ipc_channel.h" 22 #include "ipc/ipc_channel.h"
23 #include "net/proxy/mojo_proxy_resolver_factory_impl.h"
22 #include "skia/ext/image_operations.h" 24 #include "skia/ext/image_operations.h"
23 #include "third_party/skia/include/core/SkBitmap.h" 25 #include "third_party/skia/include/core/SkBitmap.h"
24 #include "third_party/zlib/google/zip.h" 26 #include "third_party/zlib/google/zip.h"
25 #include "ui/gfx/codec/jpeg_codec.h" 27 #include "ui/gfx/codec/jpeg_codec.h"
26 #include "ui/gfx/geometry/size.h" 28 #include "ui/gfx/geometry/size.h"
27 29
28 #if !defined(OS_ANDROID) 30 #if !defined(OS_ANDROID)
29 #include "chrome/utility/profile_import_handler.h" 31 #include "chrome/utility/profile_import_handler.h"
30 #endif 32 #endif
31 33
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 IPC_END_MESSAGE_MAP() 155 IPC_END_MESSAGE_MAP()
154 156
155 for (Handlers::iterator it = handlers_.begin(); 157 for (Handlers::iterator it = handlers_.begin();
156 !handled && it != handlers_.end(); ++it) { 158 !handled && it != handlers_.end(); ++it) {
157 handled = (*it)->OnMessageReceived(message); 159 handled = (*it)->OnMessageReceived(message);
158 } 160 }
159 161
160 return handled; 162 return handled;
161 } 163 }
162 164
165 namespace {
166
167 void CreateProxyResolverFactory(
168 mojo::InterfaceRequest<net::interfaces::ProxyResolverFactory> request) {
169 new net::MojoProxyResolverFactoryImpl(request.Pass());
Lei Zhang 2015/03/03 07:50:02 Can you add a comment re: MojoProxyResolverFactory
Anand Mistry (off Chromium) 2015/03/05 05:11:02 Done.
170 }
171
172 } // namespace
173
174 void ChromeContentUtilityClient::RegisterMojoServices(
175 content::ServiceRegistry* registry) {
176 registry->AddService<net::interfaces::ProxyResolverFactory>(
177 base::Bind(CreateProxyResolverFactory));
178 }
179
163 // static 180 // static
164 void ChromeContentUtilityClient::PreSandboxStartup() { 181 void ChromeContentUtilityClient::PreSandboxStartup() {
165 #if defined(ENABLE_EXTENSIONS) 182 #if defined(ENABLE_EXTENSIONS)
166 extensions::ExtensionsHandler::PreSandboxStartup(); 183 extensions::ExtensionsHandler::PreSandboxStartup();
167 #endif 184 #endif
168 185
169 #if defined(ENABLE_MDNS) 186 #if defined(ENABLE_MDNS)
170 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 187 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
171 switches::kUtilityProcessEnableMDns)) { 188 switches::kUtilityProcessEnableMDns)) {
172 local_discovery::ServiceDiscoveryMessageHandler::PreSandboxStartup(); 189 local_discovery::ServiceDiscoveryMessageHandler::PreSandboxStartup();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 const std::string& mime_type, int64 total_size, bool get_attached_images) { 361 const std::string& mime_type, int64 total_size, bool get_attached_images) {
345 // Only one IPCDataSource may be created and added to the list of handlers. 362 // Only one IPCDataSource may be created and added to the list of handlers.
346 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); 363 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size);
347 handlers_.push_back(source); 364 handlers_.push_back(source);
348 365
349 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( 366 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser(
350 source, mime_type, get_attached_images); 367 source, mime_type, get_attached_images);
351 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); 368 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser)));
352 } 369 }
353 #endif 370 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698