| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/script_context.h" | 5 #include "extensions/renderer/script_context.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 | 251 |
| 252 void ScriptContext::DispatchEvent(const char* event_name, | 252 void ScriptContext::DispatchEvent(const char* event_name, |
| 253 v8::Local<v8::Array> args) const { | 253 v8::Local<v8::Array> args) const { |
| 254 DCHECK(thread_checker_.CalledOnValidThread()); | 254 DCHECK(thread_checker_.CalledOnValidThread()); |
| 255 v8::HandleScope handle_scope(isolate()); | 255 v8::HandleScope handle_scope(isolate()); |
| 256 v8::Context::Scope context_scope(v8_context()); | 256 v8::Context::Scope context_scope(v8_context()); |
| 257 | 257 |
| 258 v8::Local<v8::Value> argv[] = {v8::String::NewFromUtf8(isolate(), event_name), | 258 v8::Local<v8::Value> argv[] = {v8::String::NewFromUtf8(isolate(), event_name), |
| 259 args}; | 259 args}; |
| 260 module_system_->CallModuleMethod( | 260 module_system_->CallModuleMethodSafe(kEventBindings, "dispatchEvent", |
| 261 kEventBindings, "dispatchEvent", arraysize(argv), argv); | 261 arraysize(argv), argv); |
| 262 } | 262 } |
| 263 | 263 |
| 264 std::string ScriptContext::GetContextTypeDescription() const { | 264 std::string ScriptContext::GetContextTypeDescription() const { |
| 265 DCHECK(thread_checker_.CalledOnValidThread()); | 265 DCHECK(thread_checker_.CalledOnValidThread()); |
| 266 return GetContextTypeDescriptionString(context_type_); | 266 return GetContextTypeDescriptionString(context_type_); |
| 267 } | 267 } |
| 268 | 268 |
| 269 std::string ScriptContext::GetEffectiveContextTypeDescription() const { | 269 std::string ScriptContext::GetEffectiveContextTypeDescription() const { |
| 270 DCHECK(thread_checker_.CalledOnValidThread()); | 270 DCHECK(thread_checker_.CalledOnValidThread()); |
| 271 return GetContextTypeDescriptionString(effective_context_type_); | 271 return GetContextTypeDescriptionString(effective_context_type_); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 v8::Local<v8::Value> argv[]) { | 518 v8::Local<v8::Value> argv[]) { |
| 519 return context_->CallFunction(function, argc, argv); | 519 return context_->CallFunction(function, argc, argv); |
| 520 } | 520 } |
| 521 | 521 |
| 522 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { | 522 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { |
| 523 v8::HandleScope handle_scope(context_->isolate()); | 523 v8::HandleScope handle_scope(context_->isolate()); |
| 524 return gin::PerContextData::From(context_->v8_context())->context_holder(); | 524 return gin::PerContextData::From(context_->v8_context())->context_holder(); |
| 525 } | 525 } |
| 526 | 526 |
| 527 } // namespace extensions | 527 } // namespace extensions |
| OLD | NEW |