| Index: sky/engine/tonic/dart_library_loader.h
|
| diff --git a/sky/engine/core/script/dart_loader.h b/sky/engine/tonic/dart_library_loader.h
|
| similarity index 69%
|
| rename from sky/engine/core/script/dart_loader.h
|
| rename to sky/engine/tonic/dart_library_loader.h
|
| index 660340934f1f77945ab2eb5ff92fab4a68e4e566..566640fb1bbe130f1ee60f458ad1a8651c3d03b7 100644
|
| --- a/sky/engine/core/script/dart_loader.h
|
| +++ b/sky/engine/tonic/dart_library_loader.h
|
| @@ -2,14 +2,13 @@
|
| // 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_LOADER_H_
|
| -#define SKY_ENGINE_CORE_SCRIPT_DART_LOADER_H_
|
| +#ifndef SKY_ENGINE_TONIC_DART_LIBRARY_LOADER_H_
|
| +#define SKY_ENGINE_TONIC_DART_LIBRARY_LOADER_H_
|
|
|
| #include "base/callback_forward.h"
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "dart/runtime/include/dart_api.h"
|
| -#include "mojo/services/network/public/interfaces/url_loader.mojom.h"
|
| #include "sky/engine/wtf/HashMap.h"
|
| #include "sky/engine/wtf/HashSet.h"
|
| #include "sky/engine/wtf/OwnPtr.h"
|
| @@ -17,26 +16,26 @@
|
| #include "sky/engine/wtf/text/WTFString.h"
|
|
|
| namespace blink {
|
| -class DartState;
|
| class DartDependency;
|
| class DartDependencyCatcher;
|
| -class KURL;
|
| +class DartLibraryProvider;
|
| +class DartState;
|
|
|
| // TODO(abarth): This class seems more complicated than it needs to be. Is
|
| // there some way of simplifying this system? For example, we have a bunch
|
| // of inner classes that could potentially be factored out in some other way.
|
| -class DartLoader {
|
| +class DartLibraryLoader {
|
| public:
|
| - explicit DartLoader(DartState* dart_state);
|
| - ~DartLoader();
|
| + explicit DartLibraryLoader(DartState* dart_state);
|
| + ~DartLibraryLoader();
|
|
|
| - // TODO(dart): This can be called both on the main thread from application isolates
|
| - // or from the handle watcher isolate thread.
|
| + // TODO(dart): This can be called both on the main thread from application
|
| + // solates or from the handle watcher isolate thread.
|
| static Dart_Handle HandleLibraryTag(Dart_LibraryTag tag,
|
| Dart_Handle library,
|
| Dart_Handle url);
|
|
|
| - void LoadLibrary(const KURL& url, mojo::URLResponsePtr response = nullptr);
|
| + void LoadLibrary(const String& name);
|
|
|
| void WaitForDependencies(const HashSet<DartDependency*>& dependencies,
|
| const base::Closure& callback);
|
| @@ -46,7 +45,14 @@ class DartLoader {
|
| dependency_catcher_ = dependency_catcher;
|
| }
|
|
|
| - DartState* dart_state() const { return dart_state_.get(); }
|
| + DartState* dart_state() const { return dart_state_; }
|
| +
|
| + DartLibraryProvider* library_provider() const { return library_provider_; }
|
| +
|
| + // The |DartLibraryProvider| must outlive the |DartLibraryLoader|.
|
| + void set_library_provider(DartLibraryProvider* library_provider) {
|
| + library_provider_ = library_provider;
|
| + }
|
|
|
| private:
|
| class Job;
|
| @@ -57,19 +63,21 @@ class DartLoader {
|
|
|
| Dart_Handle Import(Dart_Handle library, Dart_Handle url);
|
| Dart_Handle Source(Dart_Handle library, Dart_Handle url);
|
| + Dart_Handle CanonicalizeURL(Dart_Handle library, Dart_Handle url);
|
| void DidCompleteImportJob(ImportJob* job, const Vector<uint8_t>& buffer);
|
| void DidCompleteSourceJob(SourceJob* job, const Vector<uint8_t>& buffer);
|
| void DidFailJob(Job* job);
|
|
|
| - base::WeakPtr<DartState> dart_state_;
|
| + DartState* dart_state_;
|
| + DartLibraryProvider* library_provider_;
|
| HashMap<String, Job*> pending_libraries_;
|
| HashSet<OwnPtr<Job>> jobs_;
|
| HashSet<OwnPtr<DependencyWatcher>> dependency_watchers_;
|
| DartDependencyCatcher* dependency_catcher_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(DartLoader);
|
| + DISALLOW_COPY_AND_ASSIGN(DartLibraryLoader);
|
| };
|
|
|
| } // namespace blink
|
|
|
| -#endif // SKY_ENGINE_CORE_SCRIPT_DART_LOADER_H_
|
| +#endif // SKY_ENGINE_TONIC_DART_LIBRARY_LOADER_H_
|
|
|