| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" |
| 11 #include "gin/gin_export.h" | 12 #include "gin/gin_export.h" |
| 12 #include "gin/public/wrapper_info.h" | 13 #include "gin/public/wrapper_info.h" |
| 13 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 14 | 15 |
| 16 namespace base { |
| 17 class MessageLoopProxy; |
| 18 } |
| 19 |
| 15 namespace gin { | 20 namespace gin { |
| 16 | 21 |
| 17 class IndexedPropertyInterceptor; | 22 class IndexedPropertyInterceptor; |
| 18 class NamedPropertyInterceptor; | 23 class NamedPropertyInterceptor; |
| 19 class WrappableBase; | 24 class WrappableBase; |
| 20 | 25 |
| 21 // There is one instance of PerIsolateData per v8::Isolate managed by Gin. This | 26 // There is one instance of PerIsolateData per v8::Isolate managed by Gin. This |
| 22 // class stores all the Gin-related data that varies per isolate. | 27 // class stores all the Gin-related data that varies per isolate. |
| 23 class GIN_EXPORT PerIsolateData { | 28 class GIN_EXPORT PerIsolateData { |
| 24 public: | 29 public: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 53 IndexedPropertyInterceptor* interceptor); | 58 IndexedPropertyInterceptor* interceptor); |
| 54 void ClearNamedPropertyInterceptor(WrappableBase* base, | 59 void ClearNamedPropertyInterceptor(WrappableBase* base, |
| 55 NamedPropertyInterceptor* interceptor); | 60 NamedPropertyInterceptor* interceptor); |
| 56 | 61 |
| 57 IndexedPropertyInterceptor* GetIndexedPropertyInterceptor( | 62 IndexedPropertyInterceptor* GetIndexedPropertyInterceptor( |
| 58 WrappableBase* base); | 63 WrappableBase* base); |
| 59 NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base); | 64 NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base); |
| 60 | 65 |
| 61 v8::Isolate* isolate() { return isolate_; } | 66 v8::Isolate* isolate() { return isolate_; } |
| 62 v8::ArrayBuffer::Allocator* allocator() { return allocator_; } | 67 v8::ArrayBuffer::Allocator* allocator() { return allocator_; } |
| 68 base::MessageLoopProxy* message_loop_proxy() { |
| 69 return message_loop_proxy_.get(); |
| 70 } |
| 63 | 71 |
| 64 private: | 72 private: |
| 65 typedef std::map< | 73 typedef std::map< |
| 66 WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap; | 74 WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap; |
| 67 typedef std::map< | 75 typedef std::map< |
| 68 WrapperInfo*, v8::Eternal<v8::FunctionTemplate> > FunctionTemplateMap; | 76 WrapperInfo*, v8::Eternal<v8::FunctionTemplate> > FunctionTemplateMap; |
| 69 typedef std::map<WrappableBase*, IndexedPropertyInterceptor*> | 77 typedef std::map<WrappableBase*, IndexedPropertyInterceptor*> |
| 70 IndexedPropertyInterceptorMap; | 78 IndexedPropertyInterceptorMap; |
| 71 typedef std::map<WrappableBase*, NamedPropertyInterceptor*> | 79 typedef std::map<WrappableBase*, NamedPropertyInterceptor*> |
| 72 NamedPropertyInterceptorMap; | 80 NamedPropertyInterceptorMap; |
| 73 | 81 |
| 74 // PerIsolateData doesn't actually own |isolate_|. Instead, the isolate is | 82 // PerIsolateData doesn't actually own |isolate_|. Instead, the isolate is |
| 75 // owned by the IsolateHolder, which also owns the PerIsolateData. | 83 // owned by the IsolateHolder, which also owns the PerIsolateData. |
| 76 v8::Isolate* isolate_; | 84 v8::Isolate* isolate_; |
| 77 v8::ArrayBuffer::Allocator* allocator_; | 85 v8::ArrayBuffer::Allocator* allocator_; |
| 78 ObjectTemplateMap object_templates_; | 86 ObjectTemplateMap object_templates_; |
| 79 FunctionTemplateMap function_templates_; | 87 FunctionTemplateMap function_templates_; |
| 80 IndexedPropertyInterceptorMap indexed_interceptors_; | 88 IndexedPropertyInterceptorMap indexed_interceptors_; |
| 81 NamedPropertyInterceptorMap named_interceptors_; | 89 NamedPropertyInterceptorMap named_interceptors_; |
| 90 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 82 | 91 |
| 83 DISALLOW_COPY_AND_ASSIGN(PerIsolateData); | 92 DISALLOW_COPY_AND_ASSIGN(PerIsolateData); |
| 84 }; | 93 }; |
| 85 | 94 |
| 86 } // namespace gin | 95 } // namespace gin |
| 87 | 96 |
| 88 #endif // GIN_PER_ISOLATE_DATA_H_ | 97 #endif // GIN_PER_ISOLATE_DATA_H_ |
| OLD | NEW |