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

Side by Side Diff: chrome/renderer/extensions/chrome_v8_context_set.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer/extensions/chrome_v8_context_set.h" 5 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/tracked_objects.h" 9 #include "base/tracked_objects.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 CHECK(arguments.Get(i, &item)); 141 CHECK(arguments.Get(i, &item));
142 v8_arguments.push_back(converter->ToV8Value(item, context)); 142 v8_arguments.push_back(converter->ToV8Value(item, context));
143 } 143 }
144 144
145 v8::Handle<v8::Value> retval; 145 v8::Handle<v8::Value> retval;
146 (*it)->CallChromeHiddenMethod( 146 (*it)->CallChromeHiddenMethod(
147 method_name, v8_arguments.size(), &v8_arguments[0], &retval); 147 method_name, v8_arguments.size(), &v8_arguments[0], &retval);
148 // In debug, the js will validate the event parameters and return a 148 // In debug, the js will validate the event parameters and return a
149 // string if a validation error has occured. 149 // string if a validation error has occured.
150 // TODO(rafaelw): Consider only doing this check if function_name == 150 // TODO(rafaelw): Consider only doing this check if function_name ==
151 // "Event.dispatchJSON". 151 // "Event.dispatch".
152 #ifndef NDEBUG 152 #ifndef NDEBUG
153 if (!retval.IsEmpty() && !retval->IsUndefined()) { 153 if (!retval.IsEmpty() && !retval->IsUndefined()) {
154 std::string error = *v8::String::AsciiValue(retval); 154 std::string error = *v8::String::AsciiValue(retval);
155 DCHECK(false) << error; 155 DCHECK(false) << error;
156 } 156 }
157 #endif 157 #endif
158 } 158 }
159 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698