Chromium Code Reviews| Index: Source/bindings/dart/DartService.h |
| diff --git a/Source/bindings/dart/DartService.h b/Source/bindings/dart/DartService.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4eef2dc22a3dd83f7c02278581be1926f938c384 |
| --- /dev/null |
| +++ b/Source/bindings/dart/DartService.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#ifndef DartService_h |
| +#define DartService_h |
| + |
| +#include <dart_api.h> |
| +#include <dart_native_api.h> |
| + |
| +namespace WebCore { |
| + |
| +class DartServiceInternal; |
| +class Document; |
| + |
| +class DartServiceRequest { |
| +public: |
| + DartServiceRequest(const char* request); |
| + virtual ~DartServiceRequest(); |
| + |
| + // Override this method and it will be called when |
| + // the response has been received from the VM service. |
| + virtual void ResponseReady(const char* response) = 0; |
| + |
| + char* GetRequestString() { return m_request; } |
|
Jacob
2013/12/05 19:31:31
can this at least be a const char*?
To meet WebKi
Cutch
2013/12/05 22:48:15
Done.
|
| +private: |
| + char* m_request; |
| +}; |
| + |
| + |
| +class DartService { |
| +public: |
| + // Returns false if service could not be started. |
| + static bool Start(Document*); |
| + static bool Stop(); |
| + |
| + // Error message if startup failed. |
| + static const char* GetErrorMessage(); |
| + |
| + static Dart_Port port(); |
| + static Dart_Port GetRequestPort() { return m_requestPort; } |
| + static bool IsRunning(); |
| + |
| + static bool SendIsolateStartupMessage(); |
| + static bool SendIsolateShutdownMessage(); |
| + static void MakeServiceRequest(DartServiceRequest*); |
| + static void VmServiceShutdownCallback(void* callbackData); |
| + |
| +private: |
| + static void SetupNativePort(); |
| + static void NativePortMessageHandler(Dart_Port destPortId, Dart_CObject* message); |
| + static void ShutdownNativePort(); |
| + static Dart_Handle GetSource(const char* name); |
| + static Dart_Handle LoadScript(const char* name); |
| + static Dart_Handle LoadSources(Dart_Handle library, const char** names); |
| + static Dart_Handle LoadSource(Dart_Handle library, const char* name); |
| + static Dart_Handle LoadResources(Dart_Handle library); |
| + static Dart_Handle LoadResource(Dart_Handle library, const char* name, const char* prefix); |
| + static Dart_Handle LibraryTagHandler(Dart_LibraryTag, Dart_Handle library, Dart_Handle url); |
| + static Dart_NativeFunction NativeResolver(Dart_Handle name, int numArguments); |
| + static Dart_Isolate m_isolate; |
| + static Dart_Port m_port; |
| + static Dart_Port m_requestPort; |
| + static Dart_Port m_nativePort; |
| + static const char* m_errorMsg; |
| + friend class DartServiceInternal; |
| +}; |
| + |
| +} |
| + |
| +#endif // DartService_h |