OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // TODO(aa): Should only bother sending these function names if this is an | 476 // TODO(aa): Should only bother sending these function names if this is an |
477 // extension process. | 477 // extension process. |
478 std::vector<std::string> function_names; | 478 std::vector<std::string> function_names; |
479 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); | 479 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
480 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); | 480 Send(new ViewMsg_Extension_SetFunctionNames(function_names)); |
481 } | 481 } |
482 | 482 |
483 void BrowserRenderProcessHost::SendUserScriptsUpdate( | 483 void BrowserRenderProcessHost::SendUserScriptsUpdate( |
484 base::SharedMemory *shared_memory) { | 484 base::SharedMemory *shared_memory) { |
485 base::SharedMemoryHandle handle_for_process; | 485 base::SharedMemoryHandle handle_for_process; |
486 bool r = shared_memory->ShareToProcess(GetRendererProcessHandle(), | 486 if (!shared_memory->ShareToProcess(GetRendererProcessHandle(), |
487 &handle_for_process); | 487 &handle_for_process)) { |
488 DCHECK(r); | 488 // This can legitimately fail if the renderer asserts at startup. |
| 489 return; |
| 490 } |
| 491 |
489 if (base::SharedMemory::IsHandleValid(handle_for_process)) { | 492 if (base::SharedMemory::IsHandleValid(handle_for_process)) { |
490 channel_->Send(new ViewMsg_UserScripts_UpdatedScripts(handle_for_process)); | 493 channel_->Send(new ViewMsg_UserScripts_UpdatedScripts(handle_for_process)); |
491 } | 494 } |
492 } | 495 } |
493 | 496 |
494 bool BrowserRenderProcessHost::FastShutdownIfPossible() { | 497 bool BrowserRenderProcessHost::FastShutdownIfPossible() { |
495 if (!process_.handle()) | 498 if (!process_.handle()) |
496 return false; // Render process is probably crashed. | 499 return false; // Render process is probably crashed. |
497 if (BrowserRenderProcessHost::run_renderer_in_process()) | 500 if (BrowserRenderProcessHost::run_renderer_in_process()) |
498 return false; // Since process mode can't do fast shutdown. | 501 return false; // Since process mode can't do fast shutdown. |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 821 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
819 ems->AddEventListener(event_name, pid()); | 822 ems->AddEventListener(event_name, pid()); |
820 } | 823 } |
821 | 824 |
822 void BrowserRenderProcessHost::OnExtensionRemoveListener( | 825 void BrowserRenderProcessHost::OnExtensionRemoveListener( |
823 const std::string& event_name) { | 826 const std::string& event_name) { |
824 URLRequestContext* context = profile()->GetRequestContext(); | 827 URLRequestContext* context = profile()->GetRequestContext(); |
825 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 828 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
826 ems->RemoveEventListener(event_name, pid()); | 829 ems->RemoveEventListener(event_name, pid()); |
827 } | 830 } |
OLD | NEW |