OLD | NEW |
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 "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 "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 10 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 IPC::Sender* ipc_sender, | 127 IPC::Sender* ipc_sender, |
128 int routing_id, | 128 int routing_id, |
129 bool success) { | 129 bool success) { |
130 DCHECK(ipc_sender); | 130 DCHECK(ipc_sender); |
131 if (bad_message_) { | 131 if (bad_message_) { |
132 HandleBadMessage(process); | 132 HandleBadMessage(process); |
133 return; | 133 return; |
134 } | 134 } |
135 | 135 |
136 // If results were never set, we send an empty argument list. | 136 // If results were never set, we send an empty argument list. |
137 if (!results_.get()) | 137 if (!results_) |
138 results_.reset(new ListValue()); | 138 results_.reset(new ListValue()); |
139 | 139 |
140 ipc_sender->Send(new ExtensionMsg_Response( | 140 ipc_sender->Send(new ExtensionMsg_Response( |
141 routing_id, request_id_, success, *results_, GetError())); | 141 routing_id, request_id_, success, *results_, GetError())); |
142 } | 142 } |
143 | 143 |
144 void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { | 144 void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { |
145 LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; | 145 LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; |
146 if (content::RenderProcessHost::run_renderer_in_process()) { | 146 if (content::RenderProcessHost::run_renderer_in_process()) { |
147 // In single process mode it is better if we don't suicide but just crash. | 147 // In single process mode it is better if we don't suicide but just crash. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 331 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
332 } | 332 } |
333 | 333 |
334 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 334 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
335 } | 335 } |
336 | 336 |
337 void SyncIOThreadExtensionFunction::Run() { | 337 void SyncIOThreadExtensionFunction::Run() { |
338 SendResponse(RunImpl()); | 338 SendResponse(RunImpl()); |
339 } | 339 } |
OLD | NEW |