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 #ifndef GIN_PER_ISOLATE_DATA_H_ | 5 #ifndef GIN_PER_ISOLATE_DATA_H_ |
6 #define GIN_PER_ISOLATE_DATA_H_ | 6 #define GIN_PER_ISOLATE_DATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "gin/gin_export.h" | 13 #include "gin/gin_export.h" |
14 #include "gin/public/v8_idle_task_runner.h" | 14 #include "gin/public/v8_idle_task_runner.h" |
15 #include "gin/public/wrapper_info.h" | 15 #include "gin/public/wrapper_info.h" |
16 #include "v8/include/v8.h" | 16 #include "v8/include/v8.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
20 } | 20 } |
21 | 21 |
22 namespace gin { | 22 namespace gin { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 void ClearIndexedPropertyInterceptor(WrappableBase* base, | 59 void ClearIndexedPropertyInterceptor(WrappableBase* base, |
60 IndexedPropertyInterceptor* interceptor); | 60 IndexedPropertyInterceptor* interceptor); |
61 void ClearNamedPropertyInterceptor(WrappableBase* base, | 61 void ClearNamedPropertyInterceptor(WrappableBase* base, |
62 NamedPropertyInterceptor* interceptor); | 62 NamedPropertyInterceptor* interceptor); |
63 | 63 |
64 IndexedPropertyInterceptor* GetIndexedPropertyInterceptor( | 64 IndexedPropertyInterceptor* GetIndexedPropertyInterceptor( |
65 WrappableBase* base); | 65 WrappableBase* base); |
66 NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base); | 66 NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base); |
67 | 67 |
68 void EnableIdleTasks(scoped_ptr<V8IdleTaskRunner> idle_task_runner); | 68 void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner); |
69 | 69 |
70 v8::Isolate* isolate() { return isolate_; } | 70 v8::Isolate* isolate() { return isolate_; } |
71 v8::ArrayBuffer::Allocator* allocator() { return allocator_; } | 71 v8::ArrayBuffer::Allocator* allocator() { return allocator_; } |
72 base::SingleThreadTaskRunner* task_runner() { return task_runner_.get(); } | 72 base::SingleThreadTaskRunner* task_runner() { return task_runner_.get(); } |
73 V8IdleTaskRunner* idle_task_runner() { | 73 V8IdleTaskRunner* idle_task_runner() { |
74 return idle_task_runner_.get(); | 74 return idle_task_runner_.get(); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 typedef std::map< | 78 typedef std::map< |
79 WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap; | 79 WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap; |
80 typedef std::map< | 80 typedef std::map< |
81 WrapperInfo*, v8::Eternal<v8::FunctionTemplate> > FunctionTemplateMap; | 81 WrapperInfo*, v8::Eternal<v8::FunctionTemplate> > FunctionTemplateMap; |
82 typedef std::map<WrappableBase*, IndexedPropertyInterceptor*> | 82 typedef std::map<WrappableBase*, IndexedPropertyInterceptor*> |
83 IndexedPropertyInterceptorMap; | 83 IndexedPropertyInterceptorMap; |
84 typedef std::map<WrappableBase*, NamedPropertyInterceptor*> | 84 typedef std::map<WrappableBase*, NamedPropertyInterceptor*> |
85 NamedPropertyInterceptorMap; | 85 NamedPropertyInterceptorMap; |
86 | 86 |
87 // PerIsolateData doesn't actually own |isolate_|. Instead, the isolate is | 87 // PerIsolateData doesn't actually own |isolate_|. Instead, the isolate is |
88 // owned by the IsolateHolder, which also owns the PerIsolateData. | 88 // owned by the IsolateHolder, which also owns the PerIsolateData. |
89 v8::Isolate* isolate_; | 89 v8::Isolate* isolate_; |
90 v8::ArrayBuffer::Allocator* allocator_; | 90 v8::ArrayBuffer::Allocator* allocator_; |
91 ObjectTemplateMap object_templates_; | 91 ObjectTemplateMap object_templates_; |
92 FunctionTemplateMap function_templates_; | 92 FunctionTemplateMap function_templates_; |
93 IndexedPropertyInterceptorMap indexed_interceptors_; | 93 IndexedPropertyInterceptorMap indexed_interceptors_; |
94 NamedPropertyInterceptorMap named_interceptors_; | 94 NamedPropertyInterceptorMap named_interceptors_; |
95 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 95 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
96 scoped_ptr<V8IdleTaskRunner> idle_task_runner_; | 96 std::unique_ptr<V8IdleTaskRunner> idle_task_runner_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(PerIsolateData); | 98 DISALLOW_COPY_AND_ASSIGN(PerIsolateData); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace gin | 101 } // namespace gin |
102 | 102 |
103 #endif // GIN_PER_ISOLATE_DATA_H_ | 103 #endif // GIN_PER_ISOLATE_DATA_H_ |
OLD | NEW |