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

Unified Diff: sky/viewer/dart_library_provider_impl.cc

Issue 1203143004: Make it possible to run Sky apps offline (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: gn check Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/viewer/dart_library_provider_impl.h ('k') | sky/viewer/document_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/dart_library_provider_impl.cc
diff --git a/sky/viewer/dart_library_provider_impl.cc b/sky/viewer/dart_library_provider_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a0d2bee895f5d4a8a2289e59b4908afee3782fe8
--- /dev/null
+++ b/sky/viewer/dart_library_provider_impl.cc
@@ -0,0 +1,38 @@
+// 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.
+
+#include "sky/viewer/dart_library_provider_impl.h"
+
+namespace sky {
+
+DartLibraryProviderImpl::PrefetchedLibrary::PrefetchedLibrary() {
+}
+
+DartLibraryProviderImpl::PrefetchedLibrary::~PrefetchedLibrary() {
+}
+
+DartLibraryProviderImpl::DartLibraryProviderImpl(
+ mojo::NetworkService* network_service,
+ scoped_ptr<PrefetchedLibrary> prefetched)
+ : shell::DartLibraryProviderNetwork(network_service),
+ prefetched_library_(prefetched.Pass()) {
+}
+
+DartLibraryProviderImpl::~DartLibraryProviderImpl() {
+}
+
+void DartLibraryProviderImpl::GetLibraryAsStream(
+ const String& name,
+ blink::DataPipeConsumerCallback callback) {
+ if (prefetched_library_ && prefetched_library_->name == name) {
+ mojo::ScopedDataPipeConsumerHandle pipe = prefetched_library_->pipe.Pass();
+ prefetched_library_ = nullptr;
+ callback.Run(pipe.Pass());
+ return;
+ }
+
+ shell::DartLibraryProviderNetwork::GetLibraryAsStream(name, callback);
+}
+
+} // namespace sky
« no previous file with comments | « sky/viewer/dart_library_provider_impl.h ('k') | sky/viewer/document_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698