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