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

Unified Diff: sky/engine/core/script/dart_snapshot_loader.h

Issue 1197133004: Add support for snapshot loading to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix mirror-system.sky 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/core/script/dart_controller.cc ('k') | sky/engine/core/script/dart_snapshot_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/script/dart_snapshot_loader.h
diff --git a/sky/engine/core/script/dart_snapshot_loader.h b/sky/engine/core/script/dart_snapshot_loader.h
new file mode 100644
index 0000000000000000000000000000000000000000..43930069d3ed955ce67f49f4b63b15a83fd1afb6
--- /dev/null
+++ b/sky/engine/core/script/dart_snapshot_loader.h
@@ -0,0 +1,55 @@
+// 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.
+
+#ifndef SKY_ENGINE_CORE_SCRIPT_DART_SNAPSHOT_LOADER_H_
+#define SKY_ENGINE_CORE_SCRIPT_DART_SNAPSHOT_LOADER_H_
+
+#include "base/callback_forward.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "dart/runtime/include/dart_api.h"
+#include "mojo/common/data_pipe_drainer.h"
+#include "mojo/services/network/public/interfaces/url_loader.mojom.h"
+#include "sky/engine/platform/fetcher/MojoFetcher.h"
+#include "sky/engine/wtf/OwnPtr.h"
+#include "sky/engine/wtf/Vector.h"
+#include "sky/engine/wtf/text/WTFString.h"
+
+namespace blink {
+
+class DartState;
+class KURL;
+
+class DartSnapshotLoader : public MojoFetcher::Client,
+ public mojo::common::DataPipeDrainer::Client {
+ public:
+ explicit DartSnapshotLoader(DartState* dart_state);
+ ~DartSnapshotLoader();
+
+ void LoadSnapshot(const KURL& url, mojo::URLResponsePtr response,
+ const base::Closure& callback);
+
+ DartState* dart_state() const { return dart_state_.get(); }
+
+ private:
+ // MojoFetcher::Client
+ void OnReceivedResponse(mojo::URLResponsePtr response) override;
+
+ // mojo::common::DataPipeDrainer::Client
+ void OnDataAvailable(const void* data, size_t num_bytes) override;
+ void OnDataComplete() override;
+
+ base::WeakPtr<DartState> dart_state_;
+ // TODO(abarth): Should we be using SharedBuffer to buffer the data?
+ Vector<uint8_t> buffer_;
+ OwnPtr<MojoFetcher> fetcher_;
+ OwnPtr<mojo::common::DataPipeDrainer> drainer_;
+ base::Closure callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(DartSnapshotLoader);
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_CORE_SCRIPT_DART_SNAPSHOT_LOADER_H_
« no previous file with comments | « sky/engine/core/script/dart_controller.cc ('k') | sky/engine/core/script/dart_snapshot_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698