| 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 blink { |
| 14 |
| 15 class Document; |
| 16 |
| 17 class DartServiceRequest { |
| 18 public: |
| 19 DartServiceRequest(const String& request); |
| 20 virtual ~DartServiceRequest(); |
| 21 |
| 22 // Override this method and it will be called when |
| 23 // the response has been received from the VM service. |
| 24 virtual void ResponseReady(const char* response) = 0; |
| 25 |
| 26 const String& GetRequestString() { return m_request; }; |
| 27 private: |
| 28 String m_request; |
| 29 }; |
| 30 |
| 31 class DartService { |
| 32 public: |
| 33 // Returns false if service could not be started. |
| 34 static bool Start(Document*); |
| 35 // Error message if startup failed. |
| 36 static const char* GetErrorMessage(); |
| 37 static void MakeServiceRequest(DartServiceRequest*); |
| 38 static bool IsRunning() { return m_isolate; } |
| 39 |
| 40 private: |
| 41 static Dart_Handle LoadScript(); |
| 42 static Dart_NativeFunction NativeResolver(Dart_Handle name, int numArguments
, bool* autoScopeSetup); |
| 43 static Dart_Isolate m_isolate; |
| 44 static const char* m_errorMsg; |
| 45 friend class DartServiceInternal; |
| 46 }; |
| 47 |
| 48 } |
| 49 |
| 50 #endif // DartService_h |
| OLD | NEW |