| 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.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
| 17 #include "content/browser/renderer_host/resource_message_filter.h" | 17 #include "content/browser/renderer_host/resource_message_filter.h" |
| 18 #include "content/browser/trace_message_filter.h" | 18 #include "content/browser/trace_message_filter.h" |
| 19 #include "content/common/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 #include "content/common/plugin_messages.h" | 20 #include "content/common/plugin_messages.h" |
| 21 #include "content/common/process_watcher.h" | 21 #include "content/common/process_watcher.h" |
| 22 #include "content/common/result_codes.h" | 22 #include "content/common/result_codes.h" |
| 23 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
| 24 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 | 26 |
| 27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 28 #include "base/synchronization/waitable_event.h" | 28 #include "base/synchronization/waitable_event.h" |
| 29 #endif // OS_WIN | 29 #endif // OS_WIN |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 typedef std::list<BrowserChildProcessHost*> ChildProcessList; | 33 typedef std::list<BrowserChildProcessHost*> ChildProcessList; |
| 34 static base::LazyInstance<ChildProcessList> g_child_process_list( | 34 static base::LazyInstance<ChildProcessList> g_child_process_list( |
| 35 base::LINKER_INITIALIZED); | 35 base::LINKER_INITIALIZED); |
| 36 | 36 |
| 37 // The NotificationTask is used to notify about plugin process connection/ | 37 // The NotificationTask is used to notify about plugin process connection/ |
| 38 // disconnection. It is needed because the notifications in the | 38 // disconnection. It is needed because the notifications in the |
| 39 // NotificationService must happen in the main thread. | 39 // NotificationService must happen in the main thread. |
| 40 class ChildNotificationTask : public Task { | 40 class ChildNotificationTask : public Task { |
| 41 public: | 41 public: |
| 42 ChildNotificationTask( | 42 ChildNotificationTask( |
| 43 int notification_type, ChildProcessInfo* info) | 43 int notification_type, ChildProcessInfo* info) |
| 44 : notification_type_(notification_type), info_(*info) { } | 44 : notification_type_(notification_type), info_(*info) { } |
| 45 | 45 |
| 46 virtual void Run() { | 46 virtual void Run() { |
| 47 NotificationService::current()-> | 47 content::NotificationService::current()-> |
| 48 Notify(notification_type_, NotificationService::AllSources(), | 48 Notify(notification_type_, content::NotificationService::AllSources(), |
| 49 content::Details<ChildProcessInfo>(&info_)); | 49 content::Details<ChildProcessInfo>(&info_)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 int notification_type_; | 53 int notification_type_; |
| 54 ChildProcessInfo info_; | 54 ChildProcessInfo info_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 return *iterator_; | 247 return *iterator_; |
| 248 } while (true); | 248 } while (true); |
| 249 | 249 |
| 250 return NULL; | 250 return NULL; |
| 251 } | 251 } |
| 252 | 252 |
| 253 bool BrowserChildProcessHost::Iterator::Done() { | 253 bool BrowserChildProcessHost::Iterator::Done() { |
| 254 return iterator_ == g_child_process_list.Get().end(); | 254 return iterator_ == g_child_process_list.Get().end(); |
| 255 } | 255 } |
| OLD | NEW |