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

Side by Side Diff: core/inspector/CodeGeneratorInspectorStrings.py

Issue 959933002: Move IDLs to 39 roll (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Created 5 years, 10 months 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 (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 frontend_method = ("""void InspectorFrontend::$domainName::$eventName($parameter s) 63 frontend_method = ("""void InspectorFrontend::$domainName::$eventName($parameter s)
64 { 64 {
65 RefPtr<JSONObject> jsonMessage = JSONObject::create(); 65 RefPtr<JSONObject> jsonMessage = JSONObject::create();
66 jsonMessage->setString("method", "$domainName.$eventName"); 66 jsonMessage->setString("method", "$domainName.$eventName");
67 $code if (m_inspectorFrontendChannel) 67 $code if (m_inspectorFrontendChannel)
68 m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage.release()) ; 68 m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage.release()) ;
69 } 69 }
70 """) 70 """)
71 71
72 callback_main_methods = ( 72 callback_main_methods = (
73 """InspectorBackendDispatcher::$agentName::$callbackName::$callbackName(PassRefP tr<InspectorBackendDispatcherImpl> backendImpl, int id) : CallbackBase(backendIm pl, id) {} 73 """InspectorBackendDispatcher::$agentName::$callbackName::$callbackName(PassRefP trWillBeRawPtr<InspectorBackendDispatcherImpl> backendImpl, int id) : CallbackBa se(backendImpl, id) {}
74 74
75 void InspectorBackendDispatcher::$agentName::$callbackName::sendSuccess($paramet ers) 75 void InspectorBackendDispatcher::$agentName::$callbackName::sendSuccess($paramet ers)
76 { 76 {
77 RefPtr<JSONObject> jsonMessage = JSONObject::create(); 77 RefPtr<JSONObject> jsonMessage = JSONObject::create();
78 $code sendIfActive(jsonMessage, ErrorString(), PassRefPtr<JSONValue>()); 78 $code sendIfActive(jsonMessage, ErrorString(), PassRefPtr<JSONValue>());
79 } 79 }
80 """) 80 """)
81 81
82 callback_failure_method = ( 82 callback_failure_method = (
83 """void InspectorBackendDispatcher::$agentName::$callbackName::sendFailure(const ErrorString& error, $parameter) 83 """void InspectorBackendDispatcher::$agentName::$callbackName::sendFailure(const ErrorString& error, $parameter)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } // namespace blink 119 } // namespace blink
120 #endif // !defined(InspectorFrontend_h) 120 #endif // !defined(InspectorFrontend_h)
121 """) 121 """)
122 122
123 backend_h = ( 123 backend_h = (
124 """#ifndef InspectorBackendDispatcher_h 124 """#ifndef InspectorBackendDispatcher_h
125 #define InspectorBackendDispatcher_h 125 #define InspectorBackendDispatcher_h
126 126
127 #include "InspectorTypeBuilder.h" 127 #include "InspectorTypeBuilder.h"
128 128
129 #include "platform/heap/Handle.h"
129 #include "wtf/PassRefPtr.h" 130 #include "wtf/PassRefPtr.h"
130 #include "wtf/RefCounted.h" 131 #include "wtf/RefCounted.h"
131 #include "wtf/text/WTFString.h" 132 #include "wtf/text/WTFString.h"
132 133
133 namespace blink { 134 namespace blink {
134 135
135 class JSONObject; 136 class JSONObject;
136 class JSONArray; 137 class JSONArray;
137 class InspectorFrontendChannel; 138 class InspectorFrontendChannel;
138 139
139 typedef String ErrorString; 140 typedef String ErrorString;
140 141
141 class InspectorBackendDispatcherImpl; 142 class InspectorBackendDispatcherImpl;
142 143
143 class InspectorBackendDispatcher: public RefCounted<InspectorBackendDispatcher> { 144 class InspectorBackendDispatcher: public RefCountedWillBeGarbageCollectedFinaliz ed<InspectorBackendDispatcher> {
144 public: 145 public:
145 static PassRefPtr<InspectorBackendDispatcher> create(InspectorFrontendChanne l* inspectorFrontendChannel); 146 static PassRefPtrWillBeRawPtr<InspectorBackendDispatcher> create(InspectorFr ontendChannel* inspectorFrontendChannel);
146 virtual ~InspectorBackendDispatcher() { } 147 virtual ~InspectorBackendDispatcher() { }
148 virtual void trace(Visitor*) { }
147 149
148 class CallbackBase: public RefCounted<CallbackBase> { 150 class CallbackBase: public RefCountedWillBeGarbageCollectedFinalized<Callbac kBase> {
149 public: 151 public:
150 CallbackBase(PassRefPtr<InspectorBackendDispatcherImpl> backendImpl, int id); 152 CallbackBase(PassRefPtrWillBeRawPtr<InspectorBackendDispatcherImpl> back endImpl, int id);
151 virtual ~CallbackBase(); 153 virtual ~CallbackBase();
154 virtual void trace(Visitor*);
152 void sendFailure(const ErrorString&); 155 void sendFailure(const ErrorString&);
153 bool isActive(); 156 bool isActive();
154 157
155 protected: 158 protected:
156 void sendIfActive(PassRefPtr<JSONObject> partialMessage, const ErrorStri ng& invocationError, PassRefPtr<JSONValue> errorData); 159 void sendIfActive(PassRefPtr<JSONObject> partialMessage, const ErrorStri ng& invocationError, PassRefPtr<JSONValue> errorData);
157 160
158 private: 161 private:
159 void disable() { m_alreadySent = true; } 162 void disable() { m_alreadySent = true; }
160 163
161 RefPtr<InspectorBackendDispatcherImpl> m_backendImpl; 164 RefPtrWillBeMember<InspectorBackendDispatcherImpl> m_backendImpl;
162 int m_id; 165 int m_id;
163 bool m_alreadySent; 166 bool m_alreadySent;
164 167
165 friend class InspectorBackendDispatcherImpl; 168 friend class InspectorBackendDispatcherImpl;
166 }; 169 };
167 170
168 $agentInterfaces 171 $agentInterfaces
169 $virtualSetters 172 $virtualSetters
170 173
171 virtual void clearFrontend() = 0; 174 virtual void clearFrontend() = 0;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 { 274 {
272 sendResponse(callId, invocationError, RefPtr<JSONValue>(), JSONObject::c reate()); 275 sendResponse(callId, invocationError, RefPtr<JSONValue>(), JSONObject::c reate());
273 } 276 }
274 static const char InvalidParamsFormatString[]; 277 static const char InvalidParamsFormatString[];
275 }; 278 };
276 279
277 const char InspectorBackendDispatcherImpl::InvalidParamsFormatString[] = "Some a rguments of method '%s' can't be processed"; 280 const char InspectorBackendDispatcherImpl::InvalidParamsFormatString[] = "Some a rguments of method '%s' can't be processed";
278 281
279 $methods 282 $methods
280 283
281 PassRefPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(Inspec torFrontendChannel* inspectorFrontendChannel) 284 PassRefPtrWillBeRawPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::c reate(InspectorFrontendChannel* inspectorFrontendChannel)
282 { 285 {
283 return adoptRef(new InspectorBackendDispatcherImpl(inspectorFrontendChannel) ); 286 return adoptRefWillBeNoop(new InspectorBackendDispatcherImpl(inspectorFronte ndChannel));
284 } 287 }
285 288
286 289
287 void InspectorBackendDispatcherImpl::dispatch(const String& message) 290 void InspectorBackendDispatcherImpl::dispatch(const String& message)
288 { 291 {
289 RefPtr<InspectorBackendDispatcher> protect = this; 292 RefPtrWillBeRawPtr<InspectorBackendDispatcher> protect(this);
290 typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, JSO NObject* messageObject, JSONArray* protocolErrors); 293 typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, JSO NObject* messageObject, JSONArray* protocolErrors);
291 typedef HashMap<String, CallHandler> DispatchMap; 294 typedef HashMap<String, CallHandler> DispatchMap;
292 DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ); 295 DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, );
293 long callId = 0; 296 long callId = 0;
294 297
295 if (dispatchMap.isEmpty()) { 298 if (dispatchMap.isEmpty()) {
296 static const CallHandler handlers[] = { 299 static const CallHandler handlers[] = {
297 $messageHandlers 300 $messageHandlers
298 }; 301 };
299 for (size_t i = 0; i < kMethodNamesEnumSize; ++i) 302 for (size_t i = 0; i < kMethodNamesEnumSize; ++i)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 RefPtr<JSONObject> object = value->asObject(); 480 RefPtr<JSONObject> object = value->asObject();
478 if (!object) 481 if (!object)
479 return false; 482 return false;
480 483
481 if (!object->getString("method", result)) 484 if (!object->getString("method", result))
482 return false; 485 return false;
483 486
484 return true; 487 return true;
485 } 488 }
486 489
487 InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtr<InspectorBacke ndDispatcherImpl> backendImpl, int id) 490 InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtrWillBeRawPtr<In spectorBackendDispatcherImpl> backendImpl, int id)
488 : m_backendImpl(backendImpl), m_id(id), m_alreadySent(false) {} 491 : m_backendImpl(backendImpl), m_id(id), m_alreadySent(false) {}
489 492
490 InspectorBackendDispatcher::CallbackBase::~CallbackBase() {} 493 InspectorBackendDispatcher::CallbackBase::~CallbackBase() {}
491 494
495 void InspectorBackendDispatcher::CallbackBase::trace(Visitor* visitor)
496 {
497 visitor->trace(m_backendImpl);
498 }
499
492 void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString& er ror) 500 void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString& er ror)
493 { 501 {
494 ASSERT(error.length()); 502 ASSERT(error.length());
495 sendIfActive(nullptr, error, PassRefPtr<JSONValue>()); 503 sendIfActive(nullptr, error, PassRefPtr<JSONValue>());
496 } 504 }
497 505
498 bool InspectorBackendDispatcher::CallbackBase::isActive() 506 bool InspectorBackendDispatcher::CallbackBase::isActive()
499 { 507 {
500 return !m_alreadySent && m_backendImpl->isActive(); 508 return !m_alreadySent && m_backendImpl->isActive();
501 } 509 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 return m_value; 577 return m_value;
570 } 578 }
571 579
572 private: 580 private:
573 T m_value; 581 T m_value;
574 bool m_assigned; 582 bool m_assigned;
575 583
576 WTF_MAKE_NONCOPYABLE(OptOutput); 584 WTF_MAKE_NONCOPYABLE(OptOutput);
577 }; 585 };
578 586
579
580 // A small transient wrapper around int type, that can be used as a funciton par ameter type
581 // cleverly disallowing C++ implicit casts from float or double.
582 class ExactlyInt {
583 public:
584 template<typename T>
585 ExactlyInt(T t) : m_value(cast_to_int<T>(t)) {}
586
587 ExactlyInt() {}
588
589 operator int() { return m_value; }
590 private:
591 int m_value;
592
593 template<typename T>
594 static int cast_to_int(T) { return T::default_case_cast_is_not_supported(); }
595 };
596
597 template<>
598 inline int ExactlyInt::cast_to_int<int>(int i) { return i; }
599
600 template<>
601 inline int ExactlyInt::cast_to_int<unsigned int>(unsigned int i) { return i; }
602
603 class RuntimeCastHelper { 587 class RuntimeCastHelper {
604 public: 588 public:
605 #if $validatorIfdefName 589 #if $validatorIfdefName
606 template<JSONValue::Type TYPE> 590 template<JSONValue::Type TYPE>
607 static void assertType(JSONValue* value) 591 static void assertType(JSONValue* value)
608 { 592 {
609 ASSERT(value->type() == TYPE); 593 ASSERT(value->type() == TYPE);
610 } 594 }
611 static void assertAny(JSONValue*); 595 static void assertAny(JSONValue*);
612 static void assertInt(JSONValue* value); 596 static void assertInt(JSONValue* value);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 }; 930 };
947 931
948 """) 932 """)
949 933
950 class_binding_builder_part_4 = ( 934 class_binding_builder_part_4 = (
951 """ static Builder<NoFieldsSet> create() 935 """ static Builder<NoFieldsSet> create()
952 { 936 {
953 return Builder<NoFieldsSet>(JSONObject::create()); 937 return Builder<NoFieldsSet>(JSONObject::create());
954 } 938 }
955 """) 939 """)
OLDNEW
« no previous file with comments | « core/inspector/CodeGeneratorInspector.py ('k') | core/inspector/CodeGeneratorInstrumentation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698