| 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/v8_schema_registry.h" | 5 #include "extensions/renderer/v8_schema_registry.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 } // namespace | 81 } // namespace |
| 82 | 82 |
| 83 V8SchemaRegistry::V8SchemaRegistry() { | 83 V8SchemaRegistry::V8SchemaRegistry() { |
| 84 } | 84 } |
| 85 | 85 |
| 86 V8SchemaRegistry::~V8SchemaRegistry() { | 86 V8SchemaRegistry::~V8SchemaRegistry() { |
| 87 } | 87 } |
| 88 | 88 |
| 89 std::unique_ptr<NativeHandler> V8SchemaRegistry::AsNativeHandler() { | 89 std::unique_ptr<NativeHandler> V8SchemaRegistry::AsNativeHandler() { |
| 90 std::unique_ptr<ScriptContext> context( | 90 std::unique_ptr<ScriptContext> context(new ScriptContext( |
| 91 new ScriptContext(GetOrCreateContext(v8::Isolate::GetCurrent()), | 91 GetOrCreateContext(v8::Isolate::GetCurrent()), |
| 92 NULL, // no frame | 92 NULL, // no frame |
| 93 NULL, // no extension | 93 NULL, // no extension |
| 94 Feature::UNSPECIFIED_CONTEXT, | 94 Feature::UNSPECIFIED_CONTEXT, Feature::SESSION_TYPE_UNSPECIFIED, |
| 95 NULL, // no effective extension | 95 NULL, // no effective extension |
| 96 Feature::UNSPECIFIED_CONTEXT)); | 96 Feature::UNSPECIFIED_CONTEXT)); |
| 97 return std::unique_ptr<NativeHandler>( | 97 return std::unique_ptr<NativeHandler>( |
| 98 new SchemaRegistryNativeHandler(this, std::move(context))); | 98 new SchemaRegistryNativeHandler(this, std::move(context))); |
| 99 } | 99 } |
| 100 | 100 |
| 101 v8::Local<v8::Array> V8SchemaRegistry::GetSchemas( | 101 v8::Local<v8::Array> V8SchemaRegistry::GetSchemas( |
| 102 const std::vector<std::string>& apis) { | 102 const std::vector<std::string>& apis) { |
| 103 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 103 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 104 v8::EscapableHandleScope handle_scope(isolate); | 104 v8::EscapableHandleScope handle_scope(isolate); |
| 105 v8::Context::Scope context_scope(GetOrCreateContext(isolate)); | 105 v8::Context::Scope context_scope(GetOrCreateContext(isolate)); |
| 106 | 106 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (!context_holder_) { | 151 if (!context_holder_) { |
| 152 context_holder_.reset(new gin::ContextHolder(isolate)); | 152 context_holder_.reset(new gin::ContextHolder(isolate)); |
| 153 context_holder_->SetContext(v8::Context::New(isolate)); | 153 context_holder_->SetContext(v8::Context::New(isolate)); |
| 154 schema_cache_.reset(new SchemaCache(isolate)); | 154 schema_cache_.reset(new SchemaCache(isolate)); |
| 155 return context_holder_->context(); | 155 return context_holder_->context(); |
| 156 } | 156 } |
| 157 return context_holder_->context(); | 157 return context_holder_->context(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace extensions | 160 } // namespace extensions |
| OLD | NEW |