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" |
11 #include "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
12 | 12 |
13 namespace gin { | 13 namespace gin { |
14 | 14 |
15 class PerIsolateData; | 15 class PerIsolateData; |
16 | 16 |
17 // To embed Gin, first create an instance of IsolateHolder to hold the | 17 // To embed Gin, first create an instance of IsolateHolder to hold the |
18 // v8::Isolate in which you will execute JavaScript. You might wish to subclass | 18 // v8::Isolate in which you will execute JavaScript. You might wish to subclass |
19 // IsolateHolder if you want to tie more state to the lifetime of the | 19 // IsolateHolder if you want to tie more state to the lifetime of the isolate. |
20 // | 20 // |
21 // You can use gin in two modes: either gin manages V8, or the gin-embedder | 21 // You can use gin in two modes: either gin manages V8, or the gin-embedder |
22 // manages gin. If gin manages V8, use the IsolateHolder constructor without | 22 // manages gin. If gin manages V8, use the IsolateHolder constructor that does |
23 // parameters, otherwise, the gin-embedder needs to create v8::Isolates and | 23 // not take an v8::Isolate parameter, otherwise, the gin-embedder needs to |
24 // pass them to IsolateHolder. | 24 // create v8::Isolates and pass them to IsolateHolder. |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
45 bool isolate_owner_; | 45 bool isolate_owner_; |
46 v8::Isolate* isolate_; | 46 v8::Isolate* isolate_; |
47 scoped_ptr<PerIsolateData> isolate_data_; | 47 scoped_ptr<PerIsolateData> isolate_data_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); | 49 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace gin | 52 } // namespace gin |
53 | 53 |
54 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ | 54 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ |
OLD | NEW |