Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: gin/public/isolate_holder.h

Issue 101583004: [gin] Turn gin into a component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11
11 namespace v8 { 12 namespace v8 {
12 class Isolate; 13 class Isolate;
13 } 14 }
14 15
15 namespace gin { 16 namespace gin {
16 17
17 class PerIsolateData; 18 class PerIsolateData;
18 19
19 // To embed Gin, first create an instance of IsolateHolder to hold the 20 // To embed Gin, first create an instance of IsolateHolder to hold the
20 // v8::Isolate in which you will execute JavaScript. You might wish to subclass 21 // v8::Isolate in which you will execute JavaScript. You might wish to subclass
21 // IsolateHolder if you want to tie more state to the lifetime of the 22 // IsolateHolder if you want to tie more state to the lifetime of the
22 // 23 //
23 // You can use gin in two modes: either gin manages V8, or the gin-embedder 24 // You can use gin in two modes: either gin manages V8, or the gin-embedder
24 // manages gin. If gin manages V8, use the IsolateHolder constructor without 25 // manages gin. If gin manages V8, use the IsolateHolder constructor without
25 // parameters, otherwise, the gin-embedder needs to create v8::Isolates and 26 // parameters, otherwise, the gin-embedder needs to create v8::Isolates and
26 // pass them to IsolateHolder. 27 // pass them to IsolateHolder.
27 // 28 //
28 // It is not possible to mix the two. 29 // It is not possible to mix the two.
29 class IsolateHolder { 30 class GIN_EXPORT IsolateHolder {
30 public: 31 public:
31 IsolateHolder(); 32 IsolateHolder();
32 explicit IsolateHolder(v8::Isolate* isolate); 33 explicit IsolateHolder(v8::Isolate* isolate);
33 34
34 ~IsolateHolder(); 35 ~IsolateHolder();
35 36
36 v8::Isolate* isolate() { return isolate_; } 37 v8::Isolate* isolate() { return isolate_; }
37 38
38 private: 39 private:
39 bool isolate_owner_; 40 bool isolate_owner_;
40 v8::Isolate* isolate_; 41 v8::Isolate* isolate_;
41 scoped_ptr<PerIsolateData> isolate_data_; 42 scoped_ptr<PerIsolateData> isolate_data_;
42 43
43 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); 44 DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
44 }; 45 };
45 46
46 } // namespace gin 47 } // namespace gin
47 48
48 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ 49 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_
OLDNEW
« gin/array_buffer.h ('K') | « gin/public/context_holder.h ('k') | gin/public/wrapper_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698