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

Unified Diff: extensions/browser/extension_function.h

Issue 2038613003: Revert of ExtensionFunction: don't pass ownership of base::Value by raw pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/vpn_provider/vpn_provider_api.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.h
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h
index 5200d268e8be59971f4d35f556ee0eeeb38626aa..3428ee7ddc0fdfbb96639e3535d75e27abc61bf3 100644
--- a/extensions/browser/extension_function.h
+++ b/extensions/browser/extension_function.h
@@ -295,17 +295,22 @@
//
// Success, no arguments to pass to caller.
ResponseValue NoArguments();
+ // Success, a single argument |arg| to pass to caller. TAKES OWNERSHIP - a
+ // raw pointer for convenience, since callers usually construct the argument
+ // to this by hand.
+ ResponseValue OneArgument(base::Value* arg);
// Success, a single argument |arg| to pass to caller.
ResponseValue OneArgument(std::unique_ptr<base::Value> arg);
- // Success, two arguments |arg1| and |arg2| to pass to caller.
- // Note that use of this function may imply you
+ // Success, two arguments |arg1| and |arg2| to pass to caller. TAKES
+ // OWNERSHIP - raw pointers for convenience, since callers usually construct
+ // the argument to this by hand. Note that use of this function may imply you
// should be using the generated Result struct and ArgumentList.
- ResponseValue TwoArguments(std::unique_ptr<base::Value> arg1,
- std::unique_ptr<base::Value> arg2);
- // Success, a list of arguments |results| to pass to caller.
+ ResponseValue TwoArguments(base::Value* arg1, base::Value* arg2);
+ // Success, a list of arguments |results| to pass to caller. TAKES OWNERSHIP
// - a std::unique_ptr<> for convenience, since callers usually get this from
- // the result of a Create(...) call on the generated Results struct. For
- // example, alarms::Get::Results::Create(alarm).
+ // the
+ // result of a Create(...) call on the generated Results struct, for example,
+ // alarms::Get::Results::Create(alarm).
ResponseValue ArgumentList(std::unique_ptr<base::ListValue> results);
// Error. chrome.runtime.lastError.message will be set to |error|.
ResponseValue Error(const std::string& error);
@@ -321,7 +326,7 @@
const std::string& s1,
const std::string& s2,
const std::string& s3);
- // Error with a list of arguments |args| to pass to caller.
+ // Error with a list of arguments |args| to pass to caller. TAKES OWNERSHIP.
// Using this ResponseValue indicates something is wrong with the API.
// It shouldn't be possible to have both an error *and* some arguments.
// Some legacy APIs do rely on it though, like webstorePrivate.
« no previous file with comments | « extensions/browser/api/vpn_provider/vpn_provider_api.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698