Index: chrome/browser/extensions/extension_function.cc |
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc |
index d8ab5b994accbd8505b2f17b721afa744015a458..9caad98e40fb8faa1e04c2a351710aed0563fa0a 100644 |
--- a/chrome/browser/extensions/extension_function.cc |
+++ b/chrome/browser/extensions/extension_function.cc |
@@ -93,8 +93,13 @@ void ExtensionFunction::SetArgs(const base::ListValue* args) { |
args_.reset(args->DeepCopy()); |
} |
-const Value* ExtensionFunction::GetResultValue() { |
- return result_.get(); |
+void ExtensionFunction::SetResult(base::Value* result) { |
+ results_.reset(new base::ListValue()); |
+ results_->Append(result); |
+} |
+ |
+const ListValue* ExtensionFunction::GetResultList() { |
+ return results_.get(); |
} |
const std::string ExtensionFunction::GetError() { |
@@ -129,14 +134,12 @@ void ExtensionFunction::SendResponseImpl(base::ProcessHandle process, |
return; |
} |
- // Value objects can't be directly serialized in our IPC code, so we wrap the |
- // result_ Value with a ListValue (also transferring ownership of result_). |
- base::ListValue result_wrapper; |
- if (result_.get()) |
- result_wrapper.Append(result_.release()); |
+ // If results were never set, we send an empty argument list. |
+ if (!results_.get()) |
+ results_.reset(new ListValue()); |
ipc_sender->Send(new ExtensionMsg_Response( |
- routing_id, request_id_, success, result_wrapper, GetError())); |
+ routing_id, request_id_, success, *results_.release(), GetError())); |
koz (OOO until 15th September)
2012/07/13 04:48:16
Is this a memory leak?
I think a better way to do
Matt Tytel
2012/07/13 05:14:39
:( Yes that is.
As for the scoped_ptr business, t
not at google - send to devlin
2012/07/13 05:20:05
In the JSC case it's also reasonable to do
void S
|
} |
void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { |