| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 Feature::Context effective_context_type) | 101 Feature::Context effective_context_type) |
| 102 : is_valid_(true), | 102 : is_valid_(true), |
| 103 v8_context_(v8_context->GetIsolate(), v8_context), | 103 v8_context_(v8_context->GetIsolate(), v8_context), |
| 104 web_frame_(web_frame), | 104 web_frame_(web_frame), |
| 105 extension_(extension), | 105 extension_(extension), |
| 106 context_type_(context_type), | 106 context_type_(context_type), |
| 107 effective_extension_(effective_extension), | 107 effective_extension_(effective_extension), |
| 108 effective_context_type_(effective_context_type), | 108 effective_context_type_(effective_context_type), |
| 109 safe_builtins_(this), | 109 safe_builtins_(this), |
| 110 isolate_(v8_context->GetIsolate()), | 110 isolate_(v8_context->GetIsolate()), |
| 111 url_(web_frame_ ? GURL(web_frame_->document().url()) : GURL()), | 111 url_(web_frame_ ? GetDataSourceURLForFrame(web_frame_) : GURL()), |
| 112 runner_(new Runner(this)) { | 112 runner_(new Runner(this)) { |
| 113 VLOG(1) << "Created context:\n" << GetDebugString(); | 113 VLOG(1) << "Created context:\n" << GetDebugString(); |
| 114 gin::PerContextData* gin_data = gin::PerContextData::From(v8_context); | 114 gin::PerContextData* gin_data = gin::PerContextData::From(v8_context); |
| 115 CHECK(gin_data); | 115 CHECK(gin_data); |
| 116 gin_data->set_runner(runner_.get()); | 116 gin_data->set_runner(runner_.get()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 ScriptContext::~ScriptContext() { | 119 ScriptContext::~ScriptContext() { |
| 120 VLOG(1) << "Destroyed context for extension\n" | 120 VLOG(1) << "Destroyed context for extension\n" |
| 121 << " extension id: " << GetExtensionID() << "\n" | 121 << " extension id: " << GetExtensionID() << "\n" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 v8::Local<v8::Value> argv[]) { | 485 v8::Local<v8::Value> argv[]) { |
| 486 return context_->CallFunction(function, argc, argv); | 486 return context_->CallFunction(function, argc, argv); |
| 487 } | 487 } |
| 488 | 488 |
| 489 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { | 489 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { |
| 490 v8::HandleScope handle_scope(context_->isolate()); | 490 v8::HandleScope handle_scope(context_->isolate()); |
| 491 return gin::PerContextData::From(context_->v8_context())->context_holder(); | 491 return gin::PerContextData::From(context_->v8_context())->context_holder(); |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace extensions | 494 } // namespace extensions |
| OLD | NEW |