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

Unified Diff: sky/engine/tonic/dart_snapshot_loader.cc

Issue 1202283004: Factor DartLibraryProvider out of DartLoader (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/engine/tonic/dart_snapshot_loader.h ('k') | sky/engine/tonic/dart_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/tonic/dart_snapshot_loader.cc
diff --git a/sky/engine/core/script/dart_snapshot_loader.cc b/sky/engine/tonic/dart_snapshot_loader.cc
similarity index 69%
rename from sky/engine/core/script/dart_snapshot_loader.cc
rename to sky/engine/tonic/dart_snapshot_loader.cc
index d115ed716276473d6e6b21f2b5fded7fda1438b9..04b4de01a75836aae57d531a1bf2a8e72a9c3a35 100644
--- a/sky/engine/core/script/dart_snapshot_loader.cc
+++ b/sky/engine/tonic/dart_snapshot_loader.cc
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sky/engine/core/script/dart_snapshot_loader.h"
+#include "sky/engine/tonic/dart_snapshot_loader.h"
#include "base/callback.h"
#include "base/trace_event/trace_event.h"
-#include "sky/engine/platform/weborigin/KURL.h"
#include "sky/engine/tonic/dart_api_scope.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_error.h"
@@ -24,25 +23,12 @@ DartSnapshotLoader::DartSnapshotLoader(DartState* dart_state)
DartSnapshotLoader::~DartSnapshotLoader() {
}
-void DartSnapshotLoader::LoadSnapshot(const KURL& url,
- mojo::URLResponsePtr response,
+void DartSnapshotLoader::LoadSnapshot(mojo::ScopedDataPipeConsumerHandle pipe,
const base::Closure& callback) {
TRACE_EVENT_ASYNC_BEGIN0("sky", "DartSnapshotLoader::LoadSnapshot", this);
- callback_ = callback;
-
- if (!response) {
- fetcher_ = adoptPtr(new MojoFetcher(this, url));
- } else {
- OnReceivedResponse(response.Pass());
- }
-}
-void DartSnapshotLoader::OnReceivedResponse(mojo::URLResponsePtr response) {
- if (response->status_code != 200) {
- callback_.Run();
- return;
- }
- drainer_ = adoptPtr(new DataPipeDrainer(this, response->body.Pass()));
+ callback_ = callback;
+ drainer_ = adoptPtr(new DataPipeDrainer(this, pipe.Pass()));
}
void DartSnapshotLoader::OnDataAvailable(const void* data, size_t num_bytes) {
« no previous file with comments | « sky/engine/tonic/dart_snapshot_loader.h ('k') | sky/engine/tonic/dart_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698