| OLD | NEW |
| (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 #include "services/sky/dart_library_provider_impl.h" | |
| 6 | |
| 7 namespace sky { | |
| 8 | |
| 9 DartLibraryProviderImpl::PrefetchedLibrary::PrefetchedLibrary() { | |
| 10 } | |
| 11 | |
| 12 DartLibraryProviderImpl::PrefetchedLibrary::~PrefetchedLibrary() { | |
| 13 } | |
| 14 | |
| 15 DartLibraryProviderImpl::DartLibraryProviderImpl( | |
| 16 mojo::NetworkService* network_service, | |
| 17 scoped_ptr<PrefetchedLibrary> prefetched) | |
| 18 : shell::DartLibraryProviderNetwork(network_service), | |
| 19 prefetched_library_(prefetched.Pass()) { | |
| 20 } | |
| 21 | |
| 22 DartLibraryProviderImpl::~DartLibraryProviderImpl() { | |
| 23 } | |
| 24 | |
| 25 void DartLibraryProviderImpl::GetLibraryAsStream( | |
| 26 const std::string& name, | |
| 27 blink::DataPipeConsumerCallback callback) { | |
| 28 if (prefetched_library_ && prefetched_library_->name == name) { | |
| 29 mojo::ScopedDataPipeConsumerHandle pipe = prefetched_library_->pipe.Pass(); | |
| 30 prefetched_library_ = nullptr; | |
| 31 callback.Run(pipe.Pass()); | |
| 32 return; | |
| 33 } | |
| 34 | |
| 35 shell::DartLibraryProviderNetwork::GetLibraryAsStream(name, callback); | |
| 36 } | |
| 37 | |
| 38 } // namespace sky | |
| OLD | NEW |