OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 WEBKIT_GLUE_DEVTOOLS_BOUND_OBJECT_H_ | 5 #ifndef WEBKIT_GLUE_DEVTOOLS_BOUND_OBJECT_H_ |
6 #define WEBKIT_GLUE_DEVTOOLS_BOUND_OBJECT_H_ | 6 #define WEBKIT_GLUE_DEVTOOLS_BOUND_OBJECT_H_ |
7 | 7 |
| 8 #include <wtf/Noncopyable.h> |
| 9 |
8 #include "v8.h" | 10 #include "v8.h" |
9 | 11 |
10 // BoundObject lets you map JavaScript method calls and property accesses | 12 // BoundObject lets you map JavaScript method calls and property accesses |
11 // directly to C++ method calls and V8 variable access. | 13 // directly to C++ method calls and V8 variable access. |
12 class BoundObject { | 14 class BoundObject : public Noncopyable { |
13 public: | 15 public: |
14 BoundObject(v8::Handle<v8::Context> context, | 16 BoundObject(v8::Handle<v8::Context> context, |
15 void* v8_this, | 17 void* v8_this, |
16 const char* object_name); | 18 const char* object_name); |
17 virtual ~BoundObject(); | 19 virtual ~BoundObject(); |
18 | 20 |
19 void AddProtoFunction(const char* name, v8::InvocationCallback callback); | 21 void AddProtoFunction(const char* name, v8::InvocationCallback callback); |
20 void Build(); | 22 void Build(); |
21 | 23 |
22 private: | 24 private: |
23 const char* object_name_; | 25 const char* object_name_; |
24 v8::Handle<v8::Context> context_; | 26 v8::Handle<v8::Context> context_; |
25 v8::Persistent<v8::FunctionTemplate> host_template_; | 27 v8::Persistent<v8::FunctionTemplate> host_template_; |
26 v8::Persistent<v8::External> v8_this_; | 28 v8::Persistent<v8::External> v8_this_; |
27 v8::Persistent<v8::Object> bound_object_; | 29 v8::Persistent<v8::Object> bound_object_; |
28 DISALLOW_COPY_AND_ASSIGN(BoundObject); | |
29 }; | 30 }; |
30 | 31 |
31 #endif // WEBKIT_GLUE_DEVTOOLS_BOUND_OBJECT_H_ | 32 #endif // WEBKIT_GLUE_DEVTOOLS_BOUND_OBJECT_H_ |
OLD | NEW |