mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This CL implements SkyView::Load to start executing Sky content directly from Dart's main(). This code isn't currently wired up to anything, so it's not yet tested. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1130353009
69 lines
1.9 KiB
C++
69 lines
1.9 KiB
C++
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_
|
|
#define SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_
|
|
|
|
#include "base/callback_forward.h"
|
|
#include "base/macros.h"
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "dart/runtime/include/dart_api.h"
|
|
#include "sky/engine/wtf/OwnPtr.h"
|
|
#include "sky/engine/wtf/text/AtomicString.h"
|
|
#include "sky/engine/wtf/text/TextPosition.h"
|
|
|
|
namespace blink {
|
|
class AbstractModule;
|
|
class BuiltinSky;
|
|
class DOMDartState;
|
|
class DartValue;
|
|
class Document;
|
|
class HTMLScriptElement;
|
|
class KURL;
|
|
|
|
class DartController {
|
|
public:
|
|
DartController();
|
|
~DartController();
|
|
|
|
static void InitVM();
|
|
|
|
typedef base::Callback<void(RefPtr<AbstractModule>, RefPtr<DartValue>)>
|
|
LoadFinishedCallback;
|
|
|
|
void LoadMainLibrary(const KURL& url);
|
|
|
|
void LoadScriptInModule(AbstractModule* module,
|
|
const String& source,
|
|
const TextPosition& textPosition,
|
|
const LoadFinishedCallback& load_finished_callback);
|
|
void ExecuteLibraryInModule(AbstractModule* module,
|
|
Dart_Handle library,
|
|
HTMLScriptElement* script);
|
|
|
|
void ClearForClose();
|
|
void CreateIsolateFor(Document* document);
|
|
|
|
DOMDartState* dart_state() const { return dom_dart_state_.get(); }
|
|
|
|
private:
|
|
bool ImportChildLibraries(AbstractModule* module, Dart_Handle library);
|
|
Dart_Handle CreateLibrary(AbstractModule* module,
|
|
const String& source,
|
|
const TextPosition& position);
|
|
|
|
void DidLoadMainLibrary(KURL url);
|
|
|
|
OwnPtr<DOMDartState> dom_dart_state_;
|
|
OwnPtr<BuiltinSky> builtin_sky_;
|
|
|
|
base::WeakPtrFactory<DartController> weak_factory_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DartController);
|
|
};
|
|
|
|
}
|
|
|
|
#endif // SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_
|