| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/script/dart_loader.h" | 6 #include "sky/engine/core/script/dart_loader.h" |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "mojo/common/data_pipe_drainer.h" | 9 #include "mojo/common/data_pipe_drainer.h" |
| 10 #include "sky/engine/core/script/dart_dependency_catcher.h" | 10 #include "sky/engine/core/script/dart_dependency_catcher.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 CHECK(WTF::isMainThread()); | 200 CHECK(WTF::isMainThread()); |
| 201 return DOMDartState::Current()->loader().Source(library, url); | 201 return DOMDartState::Current()->loader().Source(library, url); |
| 202 } | 202 } |
| 203 DCHECK(false); | 203 DCHECK(false); |
| 204 return Dart_NewApiError("Unknown library tag."); | 204 return Dart_NewApiError("Unknown library tag."); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void DartLoader::WaitForDependencies( | 207 void DartLoader::WaitForDependencies( |
| 208 const HashSet<DartDependency*>& dependencies, | 208 const HashSet<DartDependency*>& dependencies, |
| 209 const base::Closure& callback) { | 209 const base::Closure& callback) { |
| 210 if (dependencies.isEmpty()) |
| 211 return callback.Run(); |
| 210 dependency_watchers_.add( | 212 dependency_watchers_.add( |
| 211 adoptPtr(new DependencyWatcher(dependencies, callback))); | 213 adoptPtr(new DependencyWatcher(dependencies, callback))); |
| 212 } | 214 } |
| 213 | 215 |
| 214 Dart_Handle DartLoader::Import(Dart_Handle library, Dart_Handle url) { | 216 Dart_Handle DartLoader::Import(Dart_Handle library, Dart_Handle url) { |
| 215 KURL parsed_url(ParsedURLString, StringFromDart(url)); | 217 KURL parsed_url(ParsedURLString, StringFromDart(url)); |
| 216 const auto& result = pending_libraries_.add(parsed_url.string(), nullptr); | 218 const auto& result = pending_libraries_.add(parsed_url.string(), nullptr); |
| 217 if (result.isNewEntry) { | 219 if (result.isNewEntry) { |
| 218 OwnPtr<Job> job = adoptPtr(new ImportJob(this, parsed_url)); | 220 OwnPtr<Job> job = adoptPtr(new ImportJob(this, parsed_url)); |
| 219 result.storedValue->value = job.get(); | 221 result.storedValue->value = job.get(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 275 |
| 274 WatcherSignaler watcher_signaler(*this, job); | 276 WatcherSignaler watcher_signaler(*this, job); |
| 275 | 277 |
| 276 LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data(); | 278 LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data(); |
| 277 // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case? | 279 // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case? |
| 278 | 280 |
| 279 jobs_.remove(job); | 281 jobs_.remove(job); |
| 280 } | 282 } |
| 281 | 283 |
| 282 } // namespace blink | 284 } // namespace blink |
| OLD | NEW |