| 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 "gin/wrapper_info.h" | 11 #include "gin/wrapper_info.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace gin { | 14 namespace gin { |
| 15 | 15 |
| 16 class PerIsolateData { | 16 class PerIsolateData { |
| 17 public: | 17 public: |
| 18 explicit PerIsolateData(v8::Isolate* isolate); | 18 explicit PerIsolateData(v8::Isolate* isolate); |
| 19 ~PerIsolateData(); | 19 ~PerIsolateData(); |
| 20 | 20 |
| 21 static PerIsolateData* From(v8::Isolate* isolate); | 21 static PerIsolateData* From(v8::Isolate* isolate); |
| 22 | 22 |
| 23 void SetObjectTemplate(WrapperInfo* info, | 23 void SetObjectTemplate(WrapperInfo* info, |
| 24 v8::Local<v8::ObjectTemplate> object_template); | 24 v8::Local<v8::ObjectTemplate> object_template); |
| 25 void SetFunctionTemplate(WrapperInfo* info, |
| 26 v8::Local<v8::FunctionTemplate> function_template); |
| 25 | 27 |
| 26 v8::Local<v8::ObjectTemplate> GetObjectTemplate(WrapperInfo* info); | 28 v8::Local<v8::ObjectTemplate> GetObjectTemplate(WrapperInfo* info); |
| 29 v8::Local<v8::FunctionTemplate> GetFunctionTemplate(WrapperInfo* info); |
| 27 | 30 |
| 28 private: | 31 private: |
| 29 typedef std::map< | 32 typedef std::map< |
| 30 WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap; | 33 WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap; |
| 34 typedef std::map< |
| 35 WrapperInfo*, v8::Eternal<v8::FunctionTemplate> > FunctionTemplateMap; |
| 31 | 36 |
| 32 v8::Isolate* isolate_; | 37 v8::Isolate* isolate_; |
| 33 ObjectTemplateMap object_templates_; | 38 ObjectTemplateMap object_templates_; |
| 39 FunctionTemplateMap function_templates_; |
| 34 | 40 |
| 35 DISALLOW_COPY_AND_ASSIGN(PerIsolateData); | 41 DISALLOW_COPY_AND_ASSIGN(PerIsolateData); |
| 36 }; | 42 }; |
| 37 | 43 |
| 38 } // namespace gin | 44 } // namespace gin |
| 39 | 45 |
| 40 #endif // GIN_PER_ISOLATE_DATA_H_ | 46 #endif // GIN_PER_ISOLATE_DATA_H_ |
| OLD | NEW |