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

Side by Side Diff: content/shell/shell_content_browser_client.cc

Issue 16023012: [content shell] protect against the case when a RPH dies before the process launched (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | 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/shell/shell_content_browser_client.h" 5 #include "content/shell/shell_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 host->GetChannel()->AddFilter(new ShellMessageFilter( 84 host->GetChannel()->AddFilter(new ShellMessageFilter(
85 host->GetID(), 85 host->GetID(),
86 BrowserContext::GetDefaultStoragePartition(browser_context()) 86 BrowserContext::GetDefaultStoragePartition(browser_context())
87 ->GetDatabaseTracker(), 87 ->GetDatabaseTracker(),
88 BrowserContext::GetDefaultStoragePartition(browser_context()) 88 BrowserContext::GetDefaultStoragePartition(browser_context())
89 ->GetQuotaManager())); 89 ->GetQuotaManager()));
90 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); 90 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_));
91 registrar_.Add(this, 91 registrar_.Add(this,
92 NOTIFICATION_RENDERER_PROCESS_CREATED, 92 NOTIFICATION_RENDERER_PROCESS_CREATED,
93 Source<RenderProcessHost>(host)); 93 Source<RenderProcessHost>(host));
94 registrar_.Add(this,
95 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
96 Source<RenderProcessHost>(host));
94 } 97 }
95 98
96 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( 99 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
97 BrowserContext* content_browser_context, 100 BrowserContext* content_browser_context,
98 ProtocolHandlerMap* protocol_handlers) { 101 ProtocolHandlerMap* protocol_handlers) {
99 ShellBrowserContext* shell_browser_context = 102 ShellBrowserContext* shell_browser_context =
100 ShellBrowserContextForBrowserContext(content_browser_context); 103 ShellBrowserContextForBrowserContext(content_browser_context);
101 return shell_browser_context->CreateRequestContext(protocol_handlers); 104 return shell_browser_context->CreateRequestContext(protocol_handlers);
102 } 105 }
103 106
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 #endif 208 #endif
206 209
207 void ShellContentBrowserClient::Observe(int type, 210 void ShellContentBrowserClient::Observe(int type,
208 const NotificationSource& source, 211 const NotificationSource& source,
209 const NotificationDetails& details) { 212 const NotificationDetails& details) {
210 switch (type) { 213 switch (type) {
211 case NOTIFICATION_RENDERER_PROCESS_CREATED: { 214 case NOTIFICATION_RENDERER_PROCESS_CREATED: {
212 registrar_.Remove(this, 215 registrar_.Remove(this,
213 NOTIFICATION_RENDERER_PROCESS_CREATED, 216 NOTIFICATION_RENDERER_PROCESS_CREATED,
214 source); 217 source);
218 registrar_.Remove(this,
219 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
220 source);
215 if (hyphen_dictionary_file_ != base::kInvalidPlatformFileValue) { 221 if (hyphen_dictionary_file_ != base::kInvalidPlatformFileValue) {
216 RenderProcessHost* host = Source<RenderProcessHost>(source).ptr(); 222 RenderProcessHost* host = Source<RenderProcessHost>(source).ptr();
217 IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess( 223 IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess(
218 hyphen_dictionary_file_, host->GetHandle(), false); 224 hyphen_dictionary_file_, host->GetHandle(), false);
219 host->Send(new ShellViewMsg_LoadHyphenDictionary(file)); 225 host->Send(new ShellViewMsg_LoadHyphenDictionary(file));
220 } 226 }
221 break; 227 break;
222 } 228 }
223 229
230 case NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
231 registrar_.Remove(this,
232 NOTIFICATION_RENDERER_PROCESS_CREATED,
233 source);
234 registrar_.Remove(this,
235 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
236 source);
237 break;
238 }
239
224 default: 240 default:
225 NOTREACHED(); 241 NOTREACHED();
226 } 242 }
227 } 243 }
228 244
229 ShellBrowserContext* ShellContentBrowserClient::browser_context() { 245 ShellBrowserContext* ShellContentBrowserClient::browser_context() {
230 return shell_browser_main_parts_->browser_context(); 246 return shell_browser_main_parts_->browser_context();
231 } 247 }
232 248
233 ShellBrowserContext* 249 ShellBrowserContext*
234 ShellContentBrowserClient::off_the_record_browser_context() { 250 ShellContentBrowserClient::off_the_record_browser_context() {
235 return shell_browser_main_parts_->off_the_record_browser_context(); 251 return shell_browser_main_parts_->off_the_record_browser_context();
236 } 252 }
237 253
238 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { 254 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() {
239 return new ShellAccessTokenStore(browser_context()); 255 return new ShellAccessTokenStore(browser_context());
240 } 256 }
241 257
242 ShellBrowserContext* 258 ShellBrowserContext*
243 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( 259 ShellContentBrowserClient::ShellBrowserContextForBrowserContext(
244 BrowserContext* content_browser_context) { 260 BrowserContext* content_browser_context) {
245 if (content_browser_context == browser_context()) 261 if (content_browser_context == browser_context())
246 return browser_context(); 262 return browser_context();
247 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); 263 DCHECK_EQ(content_browser_context, off_the_record_browser_context());
248 return off_the_record_browser_context(); 264 return off_the_record_browser_context();
249 } 265 }
250 266
251 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698