| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_child_process_host.h" | 5 #include "content/browser/browser_child_process_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "base/stl_util-inl.h" | 14 #include "base/stl_util-inl.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "chrome/app/breakpad_mac.h" | 16 #include "chrome/app/breakpad_mac.h" |
| 17 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
| 18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 19 #include "chrome/common/chrome_paths_internal.h" | 19 #include "chrome/common/chrome_paths_internal.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/plugin_messages.h" | 21 #include "chrome/common/plugin_messages.h" |
| 22 #include "chrome/common/process_watcher.h" | 22 #include "chrome/common/process_watcher.h" |
| 23 #include "chrome/common/result_codes.h" | 23 #include "chrome/common/result_codes.h" |
| 24 #include "chrome/installer/util/google_update_settings.h" | 24 #include "chrome/installer/util/google_update_settings.h" |
| 25 #include "content/browser/browser_thread.h" | 25 #include "content/browser/browser_thread.h" |
| 26 #include "content/common/notification_service.h" | 26 #include "content/common/notification_service.h" |
| 27 #include "content/browser/renderer_host/resource_message_filter.h" |
| 27 | 28 |
| 28 #if defined(OS_LINUX) | 29 #if defined(OS_LINUX) |
| 29 #include "base/linux_util.h" | 30 #include "base/linux_util.h" |
| 30 #endif // OS_LINUX | 31 #endif // OS_LINUX |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 typedef std::list<BrowserChildProcessHost*> ChildProcessList; | 35 typedef std::list<BrowserChildProcessHost*> ChildProcessList; |
| 35 static base::LazyInstance<ChildProcessList> g_child_process_list( | 36 static base::LazyInstance<ChildProcessList> g_child_process_list( |
| 36 base::LINKER_INITIALIZED); | 37 base::LINKER_INITIALIZED); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 private: | 54 private: |
| 54 NotificationType notification_type_; | 55 NotificationType notification_type_; |
| 55 ChildProcessInfo info_; | 56 ChildProcessInfo info_; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 } // namespace | 59 } // namespace |
| 59 | 60 |
| 60 | 61 |
| 61 BrowserChildProcessHost::BrowserChildProcessHost( | 62 BrowserChildProcessHost::BrowserChildProcessHost( |
| 62 ChildProcessInfo::ProcessType type, | 63 ChildProcessInfo::ProcessType type, |
| 63 ResourceDispatcherHost* resource_dispatcher_host, | |
| 64 ResourceMessageFilter::URLRequestContextOverride* | |
| 65 url_request_context_override) | |
| 66 : ChildProcessInfo(type, -1), | |
| 67 ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)), | |
| 68 resource_dispatcher_host_(resource_dispatcher_host) { | |
| 69 Initialize(url_request_context_override); | |
| 70 } | |
| 71 | |
| 72 BrowserChildProcessHost::BrowserChildProcessHost( | |
| 73 ChildProcessInfo::ProcessType type, | |
| 74 ResourceDispatcherHost* resource_dispatcher_host) | 64 ResourceDispatcherHost* resource_dispatcher_host) |
| 75 : ChildProcessInfo(type, -1), | 65 : ChildProcessInfo(type, -1), |
| 76 ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)), | 66 ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)), |
| 77 resource_dispatcher_host_(resource_dispatcher_host) { | 67 resource_dispatcher_host_(resource_dispatcher_host) { |
| 78 Initialize(NULL); | |
| 79 } | |
| 80 | |
| 81 void BrowserChildProcessHost::Initialize( | |
| 82 ResourceMessageFilter::URLRequestContextOverride* | |
| 83 url_request_context_override) { | |
| 84 if (resource_dispatcher_host_) { | 68 if (resource_dispatcher_host_) { |
| 85 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 69 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 86 id(), type(), resource_dispatcher_host_); | 70 id(), type, resource_dispatcher_host_); |
| 87 if (url_request_context_override) { | |
| 88 resource_message_filter->set_url_request_context_override( | |
| 89 url_request_context_override); | |
| 90 } | |
| 91 AddFilter(resource_message_filter); | 71 AddFilter(resource_message_filter); |
| 92 } | 72 } |
| 93 | 73 |
| 94 g_child_process_list.Get().push_back(this); | 74 g_child_process_list.Get().push_back(this); |
| 95 } | 75 } |
| 96 | 76 |
| 97 BrowserChildProcessHost::~BrowserChildProcessHost() { | 77 BrowserChildProcessHost::~BrowserChildProcessHost() { |
| 98 g_child_process_list.Get().remove(this); | 78 g_child_process_list.Get().remove(this); |
| 99 } | 79 } |
| 100 | 80 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 220 |
| 241 return *iterator_; | 221 return *iterator_; |
| 242 } while (true); | 222 } while (true); |
| 243 | 223 |
| 244 return NULL; | 224 return NULL; |
| 245 } | 225 } |
| 246 | 226 |
| 247 bool BrowserChildProcessHost::Iterator::Done() { | 227 bool BrowserChildProcessHost::Iterator::Done() { |
| 248 return iterator_ == g_child_process_list.Get().end(); | 228 return iterator_ == g_child_process_list.Get().end(); |
| 249 } | 229 } |
| OLD | NEW |