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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/browser_child_process_host.h ('k') | content/browser/cert_store.h » ('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) 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"
(...skipping 17 matching lines...) Expand all
28 typedef std::list<BrowserChildProcessHost*> ChildProcessList; 28 typedef std::list<BrowserChildProcessHost*> ChildProcessList;
29 static base::LazyInstance<ChildProcessList> g_child_process_list( 29 static base::LazyInstance<ChildProcessList> g_child_process_list(
30 base::LINKER_INITIALIZED); 30 base::LINKER_INITIALIZED);
31 31
32 // The NotificationTask is used to notify about plugin process connection/ 32 // The NotificationTask is used to notify about plugin process connection/
33 // disconnection. It is needed because the notifications in the 33 // disconnection. It is needed because the notifications in the
34 // NotificationService must happen in the main thread. 34 // NotificationService must happen in the main thread.
35 class ChildNotificationTask : public Task { 35 class ChildNotificationTask : public Task {
36 public: 36 public:
37 ChildNotificationTask( 37 ChildNotificationTask(
38 NotificationType notification_type, ChildProcessInfo* info) 38 int notification_type, ChildProcessInfo* info)
39 : notification_type_(notification_type), info_(*info) { } 39 : notification_type_(notification_type), info_(*info) { }
40 40
41 virtual void Run() { 41 virtual void Run() {
42 NotificationService::current()-> 42 NotificationService::current()->
43 Notify(notification_type_, NotificationService::AllSources(), 43 Notify(notification_type_, NotificationService::AllSources(),
44 Details<ChildProcessInfo>(&info_)); 44 Details<ChildProcessInfo>(&info_));
45 } 45 }
46 46
47 private: 47 private:
48 NotificationType notification_type_; 48 int notification_type_;
49 ChildProcessInfo info_; 49 ChildProcessInfo info_;
50 }; 50 };
51 51
52 } // namespace 52 } // namespace
53 53
54 BrowserChildProcessHost::BrowserChildProcessHost( 54 BrowserChildProcessHost::BrowserChildProcessHost(
55 ChildProcessInfo::ProcessType type) 55 ChildProcessInfo::ProcessType type)
56 : ChildProcessInfo(type, -1), 56 : ChildProcessInfo(type, -1),
57 ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)) { 57 ALLOW_THIS_IN_INITIALIZER_LIST(client_(this)) {
58 AddFilter(new TraceMessageFilter); 58 AddFilter(new TraceMessageFilter);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void BrowserChildProcessHost::ForceShutdown() { 106 void BrowserChildProcessHost::ForceShutdown() {
107 g_child_process_list.Get().remove(this); 107 g_child_process_list.Get().remove(this);
108 ChildProcessHost::ForceShutdown(); 108 ChildProcessHost::ForceShutdown();
109 } 109 }
110 110
111 void BrowserChildProcessHost::SetTerminateChildOnShutdown( 111 void BrowserChildProcessHost::SetTerminateChildOnShutdown(
112 bool terminate_on_shutdown) { 112 bool terminate_on_shutdown) {
113 child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown); 113 child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown);
114 } 114 }
115 115
116 void BrowserChildProcessHost::Notify(NotificationType type) { 116 void BrowserChildProcessHost::Notify(int type) {
117 BrowserThread::PostTask( 117 BrowserThread::PostTask(
118 BrowserThread::UI, FROM_HERE, new ChildNotificationTask(type, this)); 118 BrowserThread::UI, FROM_HERE, new ChildNotificationTask(type, this));
119 } 119 }
120 120
121 base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus( 121 base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus(
122 int* exit_code) { 122 int* exit_code) {
123 return child_process_->GetChildTerminationStatus(exit_code); 123 return child_process_->GetChildTerminationStatus(exit_code);
124 } 124 }
125 125
126 void BrowserChildProcessHost::OnChildDied() { 126 void BrowserChildProcessHost::OnChildDied() {
127 if (handle() != base::kNullProcessHandle) { 127 if (handle() != base::kNullProcessHandle) {
128 int exit_code; 128 int exit_code;
129 base::TerminationStatus status = GetChildTerminationStatus(&exit_code); 129 base::TerminationStatus status = GetChildTerminationStatus(&exit_code);
130 switch (status) { 130 switch (status) {
131 case base::TERMINATION_STATUS_PROCESS_CRASHED: 131 case base::TERMINATION_STATUS_PROCESS_CRASHED:
132 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: { 132 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: {
133 OnProcessCrashed(exit_code); 133 OnProcessCrashed(exit_code);
134 134
135 // Report that this child process crashed. 135 // Report that this child process crashed.
136 Notify(NotificationType::CHILD_PROCESS_CRASHED); 136 Notify(content::NOTIFICATION_CHILD_PROCESS_CRASHED);
137 UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type()); 137 UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type());
138 break; 138 break;
139 } 139 }
140 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { 140 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: {
141 OnProcessWasKilled(exit_code); 141 OnProcessWasKilled(exit_code);
142 142
143 // Report that this child process was killed. 143 // Report that this child process was killed.
144 Notify(NotificationType::CHILD_PROCESS_WAS_KILLED); 144 Notify(content::NOTIFICATION_CHILD_PROCESS_WAS_KILLED);
145 UMA_HISTOGRAM_COUNTS("ChildProcess.Kills", this->type()); 145 UMA_HISTOGRAM_COUNTS("ChildProcess.Kills", this->type());
146 break; 146 break;
147 } 147 }
148 default: 148 default:
149 break; 149 break;
150 } 150 }
151 // Notify in the main loop of the disconnection. 151 // Notify in the main loop of the disconnection.
152 Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED); 152 Notify(content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED);
153 } 153 }
154 ChildProcessHost::OnChildDied(); 154 ChildProcessHost::OnChildDied();
155 } 155 }
156 156
157 void BrowserChildProcessHost::ShutdownStarted() { 157 void BrowserChildProcessHost::ShutdownStarted() {
158 // Must remove the process from the list now, in case it gets used for a 158 // Must remove the process from the list now, in case it gets used for a
159 // new instance before our watcher tells us that the process terminated. 159 // new instance before our watcher tells us that the process terminated.
160 g_child_process_list.Get().remove(this); 160 g_child_process_list.Get().remove(this);
161 } 161 }
162 162
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 return *iterator_; 201 return *iterator_;
202 } while (true); 202 } while (true);
203 203
204 return NULL; 204 return NULL;
205 } 205 }
206 206
207 bool BrowserChildProcessHost::Iterator::Done() { 207 bool BrowserChildProcessHost::Iterator::Done() {
208 return iterator_ == g_child_process_list.Get().end(); 208 return iterator_ == g_child_process_list.Get().end();
209 } 209 }
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host.h ('k') | content/browser/cert_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698