| 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..77cd378d5775e56a10f7aca1f53cc7d944bea386
|
| --- /dev/null
|
| +++ b/Source/bindings/dart/DartService.h
|
| @@ -0,0 +1,68 @@
|
| +// 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 "wtf/text/WTFString.h"
|
| +
|
| +#include <dart_api.h>
|
| +#include <dart_native_api.h>
|
| +
|
| +namespace WebCore {
|
| +
|
| +class DartServiceInternal;
|
| +class Document;
|
| +
|
| +class DartServiceRequest {
|
| +public:
|
| + DartServiceRequest(const String& 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;
|
| +
|
| + const String& GetRequestString() { return m_request; };
|
| +private:
|
| + String 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 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 const char* m_errorMsg;
|
| + friend class DartServiceInternal;
|
| +};
|
| +
|
| +}
|
| +
|
| +#endif // DartService_h
|
|
|