| 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_PUBLIC_ISOLATE_HOLDER_H_ | 5 #ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_ |
| 6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_ | 6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "gin/gin_export.h" | 10 #include "gin/gin_export.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // | 25 // |
| 26 // It is not possible to mix the two. | 26 // It is not possible to mix the two. |
| 27 class GIN_EXPORT IsolateHolder { | 27 class GIN_EXPORT IsolateHolder { |
| 28 public: | 28 public: |
| 29 // Controls whether or not V8 should only accept strict mode scripts. | 29 // Controls whether or not V8 should only accept strict mode scripts. |
| 30 enum ScriptMode { | 30 enum ScriptMode { |
| 31 kNonStrictMode, | 31 kNonStrictMode, |
| 32 kStrictMode | 32 kStrictMode |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 explicit IsolateHolder(ScriptMode mode); | 35 IsolateHolder(); |
| 36 // Deprecated. |
| 36 IsolateHolder(v8::Isolate* isolate, v8::ArrayBuffer::Allocator* allocator); | 37 IsolateHolder(v8::Isolate* isolate, v8::ArrayBuffer::Allocator* allocator); |
| 37 | 38 |
| 38 ~IsolateHolder(); | 39 ~IsolateHolder(); |
| 39 | 40 |
| 41 // Should be invoked once before creating IsolateHolder instances to |
| 42 // initialize V8 and Gin. |
| 43 static void Initialize(ScriptMode mode, |
| 44 v8::ArrayBuffer::Allocator* allocator); |
| 45 |
| 40 v8::Isolate* isolate() { return isolate_; } | 46 v8::Isolate* isolate() { return isolate_; } |
| 41 | 47 |
| 42 private: | 48 private: |
| 43 void Init(v8::ArrayBuffer::Allocator* allocator); | 49 void Init(v8::ArrayBuffer::Allocator* allocator); |
| 44 | 50 |
| 45 bool isolate_owner_; | 51 bool isolate_owner_; |
| 46 v8::Isolate* isolate_; | 52 v8::Isolate* isolate_; |
| 47 scoped_ptr<PerIsolateData> isolate_data_; | 53 scoped_ptr<PerIsolateData> isolate_data_; |
| 48 | 54 |
| 49 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); | 55 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); |
| 50 }; | 56 }; |
| 51 | 57 |
| 52 } // namespace gin | 58 } // namespace gin |
| 53 | 59 |
| 54 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ | 60 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ |
| OLD | NEW |