Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Side by Side Diff: sky/engine/core/script/dart_loader.h

Issue 921903002: Add DartController and friends (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: More comment Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SKY_ENGINE_CORE_SCRIPT_DART_LOADER_H_
6 #define SKY_ENGINE_CORE_SCRIPT_DART_LOADER_H_
7
8 #include "base/callback_forward.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "dart/runtime/include/dart_api.h"
12 #include "sky/engine/wtf/HashMap.h"
13 #include "sky/engine/wtf/HashSet.h"
14 #include "sky/engine/wtf/OwnPtr.h"
15 #include "sky/engine/wtf/Vector.h"
16 #include "sky/engine/wtf/text/WTFString.h"
17
18 namespace blink {
19 class DartState;
20 class DartDependency;
21 class DartDependencyCatcher;
22
23 // TODO(abarth): This class seems more complicated than it needs to be. Is
24 // there some way of simplifying this system? For example, we have a bunch
25 // of inner classes that could potentially be factored out in some other way.
26 class DartLoader {
27 public:
28 explicit DartLoader(DartState* dart_state);
29 ~DartLoader();
30
31 // TODO(dart): This can be called both on the main thread from application iso lates
32 // or from the handle watcher isolate thread.
33 static Dart_Handle HandleLibraryTag(Dart_LibraryTag tag,
34 Dart_Handle library,
35 Dart_Handle url);
36
37 void WaitForDependencies(const HashSet<DartDependency*>& dependencies,
38 const base::Closure& callback);
39
40 void set_dependency_catcher(DartDependencyCatcher* dependency_catcher) {
41 DCHECK(!dependency_catcher_ || !dependency_catcher);
42 dependency_catcher_ = dependency_catcher;
43 }
44
45 DartState* dart_state() const { return dart_state_.get(); }
46
47 private:
48 class Job;
49 class ImportJob;
50 class SourceJob;
51 class DependencyWatcher;
52 class WatcherSignaler;
53
54 Dart_Handle Import(Dart_Handle library, Dart_Handle url);
55 Dart_Handle Source(Dart_Handle library, Dart_Handle url);
56 void DidCompleteImportJob(ImportJob* job, const Vector<uint8_t>& buffer);
57 void DidCompleteSourceJob(SourceJob* job, const Vector<uint8_t>& buffer);
58
59 base::WeakPtr<DartState> dart_state_;
60 HashMap<String, Job*> pending_libraries_;
61 HashSet<OwnPtr<Job>> jobs_;
62 HashSet<OwnPtr<DependencyWatcher>> dependency_watchers_;
63 DartDependencyCatcher* dependency_catcher_;
64
65 DISALLOW_COPY_AND_ASSIGN(DartLoader);
66 };
67
68 } // namespace blink
69
70 #endif // SKY_ENGINE_CORE_SCRIPT_DART_LOADER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/script/dart_dependency_catcher.cc ('k') | sky/engine/core/script/dart_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698