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 // Additional set of macros for the JS RPC. | 5 // Additional set of macros for the JS RPC. |
6 | 6 |
7 #ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_ | 7 #ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_ |
8 #define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_ | 8 #define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_ |
9 | 9 |
10 // Do not remove this one although it is not used. | 10 // Do not remove this one although it is not used. |
| 11 #include <wtf/Noncopyable.h> |
11 #include <wtf/OwnPtr.h> | 12 #include <wtf/OwnPtr.h> |
12 | 13 |
13 #include "base/basictypes.h" | |
14 #include "webkit/api/public/WebFrame.h" | 14 #include "webkit/api/public/WebFrame.h" |
15 #include "webkit/glue/devtools/bound_object.h" | 15 #include "webkit/glue/devtools/bound_object.h" |
16 #include "webkit/glue/devtools/devtools_rpc.h" | 16 #include "webkit/glue/devtools/devtools_rpc.h" |
17 #include "webkit/glue/glue_util.h" | 17 #include "webkit/glue/glue_util.h" |
18 | 18 |
19 /////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////// |
20 // JS RPC binds and stubs | 20 // JS RPC binds and stubs |
21 | 21 |
22 #define TOOLS_RPC_JS_BIND_METHOD0(Method) \ | 22 #define TOOLS_RPC_JS_BIND_METHOD0(Method) \ |
23 bound_obj_->AddProtoFunction(#Method, OCLASS::Js##Method); | 23 bound_obj_->AddProtoFunction(#Method, OCLASS::Js##Method); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 WebCore::toWebCoreStringWithNullCheck(args[0]), \ | 63 WebCore::toWebCoreStringWithNullCheck(args[0]), \ |
64 WebCore::toWebCoreStringWithNullCheck(args[1]), \ | 64 WebCore::toWebCoreStringWithNullCheck(args[1]), \ |
65 WebCore::toWebCoreStringWithNullCheck(args[2])); \ | 65 WebCore::toWebCoreStringWithNullCheck(args[2])); \ |
66 return v8::Undefined(); \ | 66 return v8::Undefined(); \ |
67 } | 67 } |
68 | 68 |
69 /////////////////////////////////////////////////////// | 69 /////////////////////////////////////////////////////// |
70 // JS RPC main obj macro | 70 // JS RPC main obj macro |
71 | 71 |
72 #define DEFINE_RPC_JS_BOUND_OBJ(Class, STRUCT, DClass, DELEGATE_STRUCT) \ | 72 #define DEFINE_RPC_JS_BOUND_OBJ(Class, STRUCT, DClass, DELEGATE_STRUCT) \ |
73 class Js##Class##BoundObj : public Class##Stub { \ | 73 class Js##Class##BoundObj : public Class##Stub, public Noncopyable { \ |
74 public: \ | 74 public: \ |
75 Js##Class##BoundObj(Delegate* rpc_delegate, \ | 75 Js##Class##BoundObj(Delegate* rpc_delegate, \ |
76 v8::Handle<v8::Context> context, \ | 76 v8::Handle<v8::Context> context, \ |
77 const char* classname) \ | 77 const char* classname) \ |
78 : Class##Stub(rpc_delegate) { \ | 78 : Class##Stub(rpc_delegate) { \ |
79 bound_obj_.set(new BoundObject(context, this, classname)); \ | 79 bound_obj_.set(new BoundObject(context, this, classname)); \ |
80 STRUCT( \ | 80 STRUCT( \ |
81 TOOLS_RPC_JS_BIND_METHOD0, \ | 81 TOOLS_RPC_JS_BIND_METHOD0, \ |
82 TOOLS_RPC_JS_BIND_METHOD1, \ | 82 TOOLS_RPC_JS_BIND_METHOD1, \ |
83 TOOLS_RPC_JS_BIND_METHOD2, \ | 83 TOOLS_RPC_JS_BIND_METHOD2, \ |
(...skipping 15 matching lines...) Expand all Loading... |
99 const String& param3) { \ | 99 const String& param3) { \ |
100 Js##Class##BoundObj* self = static_cast<Js##Class##BoundObj*>(self_ptr); \ | 100 Js##Class##BoundObj* self = static_cast<Js##Class##BoundObj*>(self_ptr); \ |
101 self->delegate_->SendRpcMessage( \ | 101 self->delegate_->SendRpcMessage( \ |
102 #Class, \ | 102 #Class, \ |
103 method, \ | 103 method, \ |
104 param1, \ | 104 param1, \ |
105 param2, \ | 105 param2, \ |
106 param3); \ | 106 param3); \ |
107 } \ | 107 } \ |
108 OwnPtr<BoundObject> bound_obj_; \ | 108 OwnPtr<BoundObject> bound_obj_; \ |
109 DISALLOW_COPY_AND_ASSIGN(Js##Class##BoundObj); \ | |
110 }; | 109 }; |
111 | 110 |
112 #endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_ | 111 #endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_JS_H_ |
OLD | NEW |