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

Side by Side Diff: sky/engine/tonic/dart_snapshot_loader.h

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 unified diff | Download patch
« no previous file with comments | « sky/engine/tonic/dart_library_provider.cc ('k') | sky/engine/tonic/dart_snapshot_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SKY_ENGINE_CORE_SCRIPT_DART_SNAPSHOT_LOADER_H_ 5 #ifndef SKY_ENGINE_TONIC_DART_SNAPSHOT_LOADER_H_
6 #define SKY_ENGINE_CORE_SCRIPT_DART_SNAPSHOT_LOADER_H_ 6 #define SKY_ENGINE_TONIC_DART_SNAPSHOT_LOADER_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "dart/runtime/include/dart_api.h" 11 #include "dart/runtime/include/dart_api.h"
12 #include "mojo/common/data_pipe_drainer.h" 12 #include "mojo/common/data_pipe_drainer.h"
13 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
14 #include "sky/engine/platform/fetcher/MojoFetcher.h"
15 #include "sky/engine/wtf/OwnPtr.h" 13 #include "sky/engine/wtf/OwnPtr.h"
16 #include "sky/engine/wtf/Vector.h" 14 #include "sky/engine/wtf/Vector.h"
17 #include "sky/engine/wtf/text/WTFString.h" 15 #include "sky/engine/wtf/text/WTFString.h"
18 16
19 namespace blink { 17 namespace blink {
18 class DartState;
20 19
21 class DartState; 20 class DartSnapshotLoader : public mojo::common::DataPipeDrainer::Client {
22 class KURL;
23
24 class DartSnapshotLoader : public MojoFetcher::Client,
25 public mojo::common::DataPipeDrainer::Client {
26 public: 21 public:
27 explicit DartSnapshotLoader(DartState* dart_state); 22 explicit DartSnapshotLoader(DartState* dart_state);
28 ~DartSnapshotLoader(); 23 ~DartSnapshotLoader();
29 24
30 void LoadSnapshot(const KURL& url, mojo::URLResponsePtr response, 25 void LoadSnapshot(mojo::ScopedDataPipeConsumerHandle pipe,
31 const base::Closure& callback); 26 const base::Closure& callback);
32 27
33 DartState* dart_state() const { return dart_state_.get(); }
34
35 private: 28 private:
36 // MojoFetcher::Client
37 void OnReceivedResponse(mojo::URLResponsePtr response) override;
38
39 // mojo::common::DataPipeDrainer::Client 29 // mojo::common::DataPipeDrainer::Client
40 void OnDataAvailable(const void* data, size_t num_bytes) override; 30 void OnDataAvailable(const void* data, size_t num_bytes) override;
41 void OnDataComplete() override; 31 void OnDataComplete() override;
42 32
43 base::WeakPtr<DartState> dart_state_; 33 base::WeakPtr<DartState> dart_state_;
34 OwnPtr<mojo::common::DataPipeDrainer> drainer_;
44 // TODO(abarth): Should we be using SharedBuffer to buffer the data? 35 // TODO(abarth): Should we be using SharedBuffer to buffer the data?
45 Vector<uint8_t> buffer_; 36 Vector<uint8_t> buffer_;
46 OwnPtr<MojoFetcher> fetcher_;
47 OwnPtr<mojo::common::DataPipeDrainer> drainer_;
48 base::Closure callback_; 37 base::Closure callback_;
49 38
50 DISALLOW_COPY_AND_ASSIGN(DartSnapshotLoader); 39 DISALLOW_COPY_AND_ASSIGN(DartSnapshotLoader);
51 }; 40 };
52 41
53 } // namespace blink 42 } // namespace blink
54 43
55 #endif // SKY_ENGINE_CORE_SCRIPT_DART_SNAPSHOT_LOADER_H_ 44 #endif // SKY_ENGINE_TONIC_DART_SNAPSHOT_LOADER_H_
OLDNEW
« no previous file with comments | « sky/engine/tonic/dart_library_provider.cc ('k') | sky/engine/tonic/dart_snapshot_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698