Disable signin-to-Chrome when using Guest profile.
[chromium-blink-merge.git] / gin / public / isolate_holder.h
blobeebafa7bcf22056ada3e4fc49624e0837f91490d
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
3 // found in the LICENSE file.
5 #ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_
6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "gin/gin_export.h"
11 #include "v8/include/v8.h"
13 namespace gin {
15 class PerIsolateData;
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
19 // IsolateHolder if you want to tie more state to the lifetime of the
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
23 // parameters, otherwise, the gin-embedder needs to create v8::Isolates and
24 // pass them to IsolateHolder.
26 // It is not possible to mix the two.
27 class GIN_EXPORT IsolateHolder {
28 public:
29 IsolateHolder();
30 IsolateHolder(v8::Isolate* isolate, v8::ArrayBuffer::Allocator* allocator);
32 ~IsolateHolder();
34 v8::Isolate* isolate() { return isolate_; }
36 private:
37 void Init(v8::ArrayBuffer::Allocator* allocator);
39 bool isolate_owner_;
40 v8::Isolate* isolate_;
41 scoped_ptr<PerIsolateData> isolate_data_;
43 DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
46 } // namespace gin
48 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_