| 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 "chrome/browser/extensions/extension_function.h" | 5 #include "chrome/browser/extensions/extension_function.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 12 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 13 #include "chrome/common/extensions/extension_messages.h" | 13 #include "chrome/common/extensions/extension_messages.h" |
| 14 #include "content/browser/renderer_host/render_process_host.h" | |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 14 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/user_metrics.h" | 15 #include "content/browser/user_metrics.h" |
| 17 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
| 18 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
| 18 #include "content/public/browser/render_process_host.h" |
| 19 #include "content/public/common/result_codes.h" | 19 #include "content/public/common/result_codes.h" |
| 20 | 20 |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) { | 24 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) { |
| 25 x->Destruct(); | 25 x->Destruct(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker( | 28 UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker( |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 HandleBadMessage(process); | 109 HandleBadMessage(process); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 | 112 |
| 113 ipc_sender->Send(new ExtensionMsg_Response( | 113 ipc_sender->Send(new ExtensionMsg_Response( |
| 114 routing_id, request_id_, success, GetResult(), GetError())); | 114 routing_id, request_id_, success, GetResult(), GetError())); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { | 117 void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { |
| 118 LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; | 118 LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; |
| 119 if (RenderProcessHost::run_renderer_in_process()) { | 119 if (content::RenderProcessHost::run_renderer_in_process()) { |
| 120 // In single process mode it is better if we don't suicide but just crash. | 120 // In single process mode it is better if we don't suicide but just crash. |
| 121 CHECK(false); | 121 CHECK(false); |
| 122 } else { | 122 } else { |
| 123 NOTREACHED(); | 123 NOTREACHED(); |
| 124 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_EFD")); | 124 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_EFD")); |
| 125 if (process) | 125 if (process) |
| 126 base::KillProcess(process, content::RESULT_CODE_KILLED_BAD_MESSAGE, | 126 base::KillProcess(process, content::RESULT_CODE_KILLED_BAD_MESSAGE, |
| 127 false); | 127 false); |
| 128 } | 128 } |
| 129 } | 129 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 213 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
| 214 } | 214 } |
| 215 | 215 |
| 216 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 216 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
| 217 } | 217 } |
| 218 | 218 |
| 219 void SyncIOThreadExtensionFunction::Run() { | 219 void SyncIOThreadExtensionFunction::Run() { |
| 220 SendResponse(RunImpl()); | 220 SendResponse(RunImpl()); |
| 221 } | 221 } |
| OLD | NEW |