OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/message_loop/message_loop_proxy.h" | 6 #include "base/single_thread_task_runner.h" |
| 7 #include "base/thread_task_runner_handle.h" |
7 #include "gin/per_isolate_data.h" | 8 #include "gin/per_isolate_data.h" |
8 #include "gin/public/gin_embedders.h" | 9 #include "gin/public/gin_embedders.h" |
9 | 10 |
10 using v8::ArrayBuffer; | 11 using v8::ArrayBuffer; |
11 using v8::Eternal; | 12 using v8::Eternal; |
12 using v8::Isolate; | 13 using v8::Isolate; |
13 using v8::Local; | 14 using v8::Local; |
14 using v8::Object; | 15 using v8::Object; |
15 using v8::FunctionTemplate; | 16 using v8::FunctionTemplate; |
16 using v8::ObjectTemplate; | 17 using v8::ObjectTemplate; |
17 | 18 |
18 namespace gin { | 19 namespace gin { |
19 | 20 |
20 PerIsolateData::PerIsolateData(Isolate* isolate, | 21 PerIsolateData::PerIsolateData(Isolate* isolate, |
21 ArrayBuffer::Allocator* allocator) | 22 ArrayBuffer::Allocator* allocator) |
22 : isolate_(isolate), | 23 : isolate_(isolate), |
23 allocator_(allocator), | 24 allocator_(allocator), |
24 message_loop_proxy_(base::MessageLoopProxy::current()) { | 25 task_runner_(base::ThreadTaskRunnerHandle::Get()) { |
25 isolate_->SetData(kEmbedderNativeGin, this); | 26 isolate_->SetData(kEmbedderNativeGin, this); |
26 } | 27 } |
27 | 28 |
28 PerIsolateData::~PerIsolateData() { | 29 PerIsolateData::~PerIsolateData() { |
29 isolate_->SetData(kEmbedderNativeGin, NULL); | 30 isolate_->SetData(kEmbedderNativeGin, NULL); |
30 } | 31 } |
31 | 32 |
32 PerIsolateData* PerIsolateData::From(Isolate* isolate) { | 33 PerIsolateData* PerIsolateData::From(Isolate* isolate) { |
33 return static_cast<PerIsolateData*>(isolate->GetData(kEmbedderNativeGin)); | 34 return static_cast<PerIsolateData*>(isolate->GetData(kEmbedderNativeGin)); |
34 } | 35 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 NamedPropertyInterceptor* PerIsolateData::GetNamedPropertyInterceptor( | 104 NamedPropertyInterceptor* PerIsolateData::GetNamedPropertyInterceptor( |
104 WrappableBase* base) { | 105 WrappableBase* base) { |
105 NamedPropertyInterceptorMap::iterator it = named_interceptors_.find(base); | 106 NamedPropertyInterceptorMap::iterator it = named_interceptors_.find(base); |
106 if (it != named_interceptors_.end()) | 107 if (it != named_interceptors_.end()) |
107 return it->second; | 108 return it->second; |
108 else | 109 else |
109 return NULL; | 110 return NULL; |
110 } | 111 } |
111 | 112 |
112 } // namespace gin | 113 } // namespace gin |
OLD | NEW |