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

Unified Diff: chrome/browser/extensions/api/web_request/web_request_api.cc

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and review changes. Created 8 years, 5 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
Index: chrome/browser/extensions/api/web_request/web_request_api.cc
diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc
index fb5aa999aa26623cad067f5d00bcad0ea03f2eff..2e97a726284e6080edf636a506824ac0b6eaaf7a 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api.cc
@@ -917,15 +917,13 @@ bool ExtensionWebRequestEventRouter::DispatchEvent(
net::URLRequest* request,
const std::vector<const EventListener*>& listeners,
const ListValue& args) {
- std::string json_args;
-
// TODO(mpcomplete): Consider consolidating common (extension_id,json_args)
// pairs into a single message sent to a list of sub_event_names.
int num_handlers_blocking = 0;
for (std::vector<const EventListener*>::const_iterator it = listeners.begin();
it != listeners.end(); ++it) {
// Filter out the optional keys that this listener didn't request.
- scoped_ptr<ListValue> args_filtered(args.DeepCopy());
+ ListValue* args_filtered = args.DeepCopy();
DictionaryValue* dict = NULL;
CHECK(args_filtered->GetDictionary(0, &dict) && dict);
if (!((*it)->extra_info_spec & ExtraInfoSpec::REQUEST_HEADERS))
@@ -933,11 +931,9 @@ bool ExtensionWebRequestEventRouter::DispatchEvent(
if (!((*it)->extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS))
dict->Remove(keys::kResponseHeadersKey, NULL);
- base::JSONWriter::Write(args_filtered.get(), &json_args);
-
ExtensionEventRouter::DispatchEvent(
(*it)->ipc_sender.get(), (*it)->extension_id, (*it)->sub_event_name,
- json_args, GURL(), ExtensionEventRouter::USER_GESTURE_UNKNOWN,
+ args_filtered, GURL(), ExtensionEventRouter::USER_GESTURE_UNKNOWN,
EventFilteringInfo());
if ((*it)->extra_info_spec &
(ExtraInfoSpec::BLOCKING | ExtraInfoSpec::ASYNC_BLOCKING)) {

Powered by Google App Engine
This is Rietveld 408576698