Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DartService_h | |
| 6 #define DartService_h | |
| 7 | |
| 8 #include "wtf/text/WTFString.h" | |
| 9 | |
| 10 #include <dart_api.h> | |
| 11 #include <dart_native_api.h> | |
| 12 | |
| 13 namespace WebCore { | |
| 14 | |
| 15 class DartServiceInternal; | |
| 16 class Document; | |
| 17 | |
| 18 class DartServiceRequest { | |
| 19 public: | |
| 20 DartServiceRequest(const String& request); | |
| 21 virtual ~DartServiceRequest(); | |
| 22 | |
| 23 // Override this method and it will be called when | |
| 24 // the response has been received from the VM service. | |
| 25 virtual void ResponseReady(const char* response) = 0; | |
| 26 | |
| 27 const String& GetRequestString() { return m_request; }; | |
|
siva
2013/12/13 21:48:23
GetRequestString() const { ... }
| |
| 28 private: | |
| 29 String m_request; | |
| 30 }; | |
| 31 | |
| 32 class DartService { | |
| 33 public: | |
| 34 // Returns false if service could not be started. | |
| 35 static bool Start(Document*); | |
| 36 static bool Stop(); | |
| 37 | |
| 38 // Error message if startup failed. | |
| 39 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*); | |
| 48 static void VmServiceShutdownCallback(void* callbackData); | |
| 49 | |
| 50 private: | |
| 51 static Dart_Handle GetSource(const char* name); | |
| 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 ); | |
| 59 static Dart_Isolate m_isolate; | |
| 60 static Dart_Port m_port; | |
| 61 static Dart_Port m_requestPort; | |
| 62 static const char* m_errorMsg; | |
| 63 friend class DartServiceInternal; | |
| 64 }; | |
| 65 | |
| 66 } | |
| 67 | |
| 68 #endif // DartService_h | |
| OLD | NEW |