OLD | NEW |
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 Loading... |
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 |
OLD | NEW |