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

Side by Side Diff: Source/bindings/dart/DartService.h

Issue 128733002: Refactor service usage in Dartium (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1700
Patch Set: Created 6 years, 11 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, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef DartService_h 5 #ifndef DartService_h
6 #define DartService_h 6 #define DartService_h
7 7
8 #include "wtf/text/WTFString.h" 8 #include "wtf/text/WTFString.h"
9 9
10 #include <dart_api.h> 10 #include <dart_api.h>
11 #include <dart_native_api.h> 11 #include <dart_native_api.h>
12 12
13 namespace WebCore { 13 namespace WebCore {
14 14
15 class DartServiceInternal;
16 class Document; 15 class Document;
17 16
18 class DartServiceRequest { 17 class DartServiceRequest {
19 public: 18 public:
20 DartServiceRequest(const String& request); 19 DartServiceRequest(const String& request);
21 virtual ~DartServiceRequest(); 20 virtual ~DartServiceRequest();
22 21
23 // Override this method and it will be called when 22 // Override this method and it will be called when
24 // the response has been received from the VM service. 23 // the response has been received from the VM service.
25 virtual void ResponseReady(const char* response) = 0; 24 virtual void ResponseReady(const char* response) = 0;
26 25
27 const String& GetRequestString() { return m_request; }; 26 const String& GetRequestString() { return m_request; };
28 private: 27 private:
29 String m_request; 28 String m_request;
30 }; 29 };
31 30
32 class DartService { 31 class DartService {
33 public: 32 public:
34 // Returns false if service could not be started. 33 // Returns false if service could not be started.
35 static bool Start(Document*); 34 static bool Start(Document*);
36 static bool Stop();
37
38 // Error message if startup failed. 35 // Error message if startup failed.
39 static const char* GetErrorMessage(); 36 static const char* GetErrorMessage();
40
41 static Dart_Port port();
42 static Dart_Port GetRequestPort() { return m_requestPort; }
43 static bool IsRunning();
44
45 static bool SendIsolateStartupMessage();
46 static bool SendIsolateShutdownMessage();
47 static void MakeServiceRequest(DartServiceRequest*); 37 static void MakeServiceRequest(DartServiceRequest*);
48 static void VmServiceShutdownCallback(void* callbackData); 38 static bool IsRunning() { return m_isolate != 0; } // NOLINT
siva 2014/01/14 18:57:34 I think we don't compare against 0 in dartium code
Cutch 2014/01/14 21:17:18 Done.
49 39
50 private: 40 private:
51 static Dart_Handle GetSource(const char* name); 41 static Dart_Handle LoadScript();
52 static Dart_Handle LoadScript(const char* name);
53 static Dart_Handle LoadSources(Dart_Handle library, const char** names);
54 static Dart_Handle LoadSource(Dart_Handle library, const char* name);
55 static Dart_Handle LoadResources(Dart_Handle library);
56 static Dart_Handle LoadResource(Dart_Handle library, const char* name, const char* prefix);
57 static Dart_Handle LibraryTagHandler(Dart_LibraryTag, Dart_Handle library, D art_Handle url);
58 static Dart_NativeFunction NativeResolver(Dart_Handle name, int numArguments , bool* autoScopeSetup); 42 static Dart_NativeFunction NativeResolver(Dart_Handle name, int numArguments , bool* autoScopeSetup);
59 static Dart_Isolate m_isolate; 43 static Dart_Isolate m_isolate;
60 static Dart_Port m_port;
61 static Dart_Port m_requestPort;
62 static const char* m_errorMsg; 44 static const char* m_errorMsg;
63 friend class DartServiceInternal; 45 friend class DartServiceInternal;
64 }; 46 };
65 47
66 } 48 }
67 49
68 #endif // DartService_h 50 #endif // DartService_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698