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

Side by Side Diff: webkit/glue/devtools/devtools_rpc.h

Issue 330029: DevTools: Remove base/ dependencies from glue/devtools (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « webkit/glue/devtools/debugger_agent_manager.cc ('k') | webkit/glue/devtools/devtools_rpc_js.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // DevTools RPC subsystem is a simple string serialization-based rpc 5 // DevTools RPC subsystem is a simple string serialization-based rpc
6 // implementation. The client is responsible for defining the Rpc-enabled 6 // implementation. The client is responsible for defining the Rpc-enabled
7 // interface in terms of its macros: 7 // interface in terms of its macros:
8 // 8 //
9 // #define MYAPI_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) 9 // #define MYAPI_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3)
10 // METHOD0(Method1) 10 // METHOD0(Method1)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // MyApi* real_object; 45 // MyApi* real_object;
46 // MyApiDispatch::Dispatch(real_object, raw_string_call_generated_by_stub); 46 // MyApiDispatch::Dispatch(real_object, raw_string_call_generated_by_stub);
47 // 47 //
48 // will make corresponding calls to the real object. 48 // will make corresponding calls to the real object.
49 49
50 #ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_ 50 #ifndef WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
51 #define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_ 51 #define WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
52 52
53 #include "PlatformString.h" 53 #include "PlatformString.h"
54 54
55 // TODO(darin): Remove these dependencies on Chromium base/. 55 #include <wtf/Noncopyable.h>
56 #include "base/basictypes.h"
57 #include "base/compiler_specific.h"
58 56
59 namespace WebCore { 57 namespace WebCore {
60 class String; 58 class String;
61 } 59 }
62 60
63 using WebCore::String; 61 using WebCore::String;
64 62
65 /////////////////////////////////////////////////////// 63 ///////////////////////////////////////////////////////
66 // RPC dispatch macro 64 // RPC dispatch macro
67 65
68 template<typename T> 66 template<typename T>
69 struct RpcTypeTrait { 67 struct RpcTypeTrait {
70 typedef T ApiType; 68 typedef T ApiType;
71 }; 69 };
72 70
73 template<> 71 template<>
74 struct RpcTypeTrait<bool> { 72 struct RpcTypeTrait<bool> {
75 typedef bool ApiType; 73 typedef bool ApiType;
76 static bool Parse(const WebCore::String& t) { 74 static bool Parse(const WebCore::String& t) {
77 ALLOW_UNUSED bool success; 75 bool success;
78 int i = t.toIntStrict(&success); 76 int i = t.toIntStrict(&success);
79 ASSERT(success); 77 ASSERT(success);
80 return i; 78 return i;
81 } 79 }
82 static WebCore::String ToString(bool b) { 80 static WebCore::String ToString(bool b) {
83 return WebCore::String::number(b ? 1 : 0); 81 return WebCore::String::number(b ? 1 : 0);
84 } 82 }
85 }; 83 };
86 84
87 template<> 85 template<>
88 struct RpcTypeTrait<int> { 86 struct RpcTypeTrait<int> {
89 typedef int ApiType; 87 typedef int ApiType;
90 static int Parse(const WebCore::String& t) { 88 static int Parse(const WebCore::String& t) {
91 ALLOW_UNUSED bool success; 89 bool success;
92 int i = t.toIntStrict(&success); 90 int i = t.toIntStrict(&success);
93 ASSERT(success); 91 ASSERT(success);
94 return i; 92 return i;
95 } 93 }
96 static WebCore::String ToString(int i) { 94 static WebCore::String ToString(int i) {
97 return WebCore::String::number(i); 95 return WebCore::String::number(i);
98 } 96 }
99 }; 97 };
100 98
101 template<> 99 template<>
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 TOOLS_RPC_DISPATCH2, \ 256 TOOLS_RPC_DISPATCH2, \
259 TOOLS_RPC_DISPATCH3) \ 257 TOOLS_RPC_DISPATCH3) \
260 return false; \ 258 return false; \
261 } \ 259 } \
262 private: \ 260 private: \
263 DISALLOW_COPY_AND_ASSIGN(Class##Dispatch); \ 261 DISALLOW_COPY_AND_ASSIGN(Class##Dispatch); \
264 }; 262 };
265 263
266 /////////////////////////////////////////////////////// 264 ///////////////////////////////////////////////////////
267 // RPC base class 265 // RPC base class
268 class DevToolsRpc { 266 class DevToolsRpc : public Noncopyable {
269 public: 267 public:
270 class Delegate { 268 class Delegate : public Noncopyable {
271 public: 269 public:
272 Delegate() {} 270 Delegate() {}
273 virtual ~Delegate() {} 271 virtual ~Delegate() {}
274 virtual void SendRpcMessage(const WebCore::String& class_name, 272 virtual void SendRpcMessage(const WebCore::String& class_name,
275 const WebCore::String& method_name, 273 const WebCore::String& method_name,
276 const WebCore::String& p1 = "", 274 const WebCore::String& p1 = "",
277 const WebCore::String& p2 = "", 275 const WebCore::String& p2 = "",
278 const WebCore::String& p3 = "") = 0; 276 const WebCore::String& p3 = "") = 0;
279 private:
280 DISALLOW_COPY_AND_ASSIGN(Delegate);
281 }; 277 };
282 278
283 explicit DevToolsRpc(Delegate* delegate) 279 explicit DevToolsRpc(Delegate* delegate)
284 : delegate_(delegate) {} 280 : delegate_(delegate) {}
285 virtual ~DevToolsRpc() {}; 281 virtual ~DevToolsRpc() {};
286 282
287 protected: 283 protected:
288 Delegate* delegate_; 284 Delegate* delegate_;
289 private:
290 DISALLOW_COPY_AND_ASSIGN(DevToolsRpc);
291 }; 285 };
292 286
293 #endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_ 287 #endif // WEBKIT_GLUE_DEVTOOLS_DEVTOOLS_RPC_H_
OLDNEW
« no previous file with comments | « webkit/glue/devtools/debugger_agent_manager.cc ('k') | webkit/glue/devtools/devtools_rpc_js.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698