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

Side by Side Diff: extensions/renderer/event_emitter.cc

Issue 2822373002: [Reland][gin] Add Arguments::GetAll() (Closed)
Patch Set: Fix Created 3 years, 8 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
« no previous file with comments | « no previous file | gin/arguments.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "extensions/renderer/event_emitter.h" 5 #include "extensions/renderer/event_emitter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "extensions/renderer/api_event_listeners.h" 9 #include "extensions/renderer/api_event_listeners.h"
10 #include "gin/object_template_builder.h" 10 #include "gin/object_template_builder.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 void EventEmitter::Dispatch(gin::Arguments* arguments) { 124 void EventEmitter::Dispatch(gin::Arguments* arguments) {
125 if (!valid_) 125 if (!valid_)
126 return; 126 return;
127 127
128 if (listeners_->GetNumListeners() == 0) 128 if (listeners_->GetNumListeners() == 0)
129 return; 129 return;
130 v8::HandleScope handle_scope(arguments->isolate()); 130 v8::HandleScope handle_scope(arguments->isolate());
131 v8::Local<v8::Context> context = 131 v8::Local<v8::Context> context =
132 arguments->isolate()->GetCurrentContext(); 132 arguments->isolate()->GetCurrentContext();
133 std::vector<v8::Local<v8::Value>> v8_args; 133 std::vector<v8::Local<v8::Value>> v8_args = arguments->GetAll();
134 if (arguments->Length() > 0) {
135 // Converting to v8::Values should never fail.
136 CHECK(arguments->GetRemaining(&v8_args));
137 }
138 Fire(context, &v8_args, nullptr); 134 Fire(context, &v8_args, nullptr);
139 } 135 }
140 136
141 } // namespace extensions 137 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | gin/arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698