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

Side by Side Diff: shell/application_manager/network_fetcher.h

Issue 1354623002: Force offline by default for warm benchmarks. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
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 SHELL_APPLICATION_MANAGER_NETWORK_FETCHER_H_ 5 #ifndef SHELL_APPLICATION_MANAGER_NETWORK_FETCHER_H_
6 #define SHELL_APPLICATION_MANAGER_NETWORK_FETCHER_H_ 6 #define SHELL_APPLICATION_MANAGER_NETWORK_FETCHER_H_
7 7
8 #include "shell/application_manager/fetcher.h" 8 #include "shell/application_manager/fetcher.h"
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 12 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
13 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" 13 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
14 #include "mojo/services/url_response_disk_cache/public/interfaces/url_response_d isk_cache.mojom.h" 14 #include "mojo/services/url_response_disk_cache/public/interfaces/url_response_d isk_cache.mojom.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace shell { 17 namespace shell {
18 18
19 // Implements Fetcher for http[s] files. 19 // Implements Fetcher for http[s] files.
20 class NetworkFetcher : public Fetcher { 20 class NetworkFetcher : public Fetcher {
21 public: 21 public:
22 NetworkFetcher(bool disable_cache, 22 NetworkFetcher(bool disable_cache,
23 bool force_offline_by_default,
23 const GURL& url, 24 const GURL& url,
24 mojo::URLResponseDiskCache* url_response_disk_cache, 25 mojo::URLResponseDiskCache* url_response_disk_cache,
25 mojo::NetworkService* network_service, 26 mojo::NetworkService* network_service,
26 const FetchCallback& loader_callback); 27 const FetchCallback& loader_callback);
27 28
28 ~NetworkFetcher() override; 29 ~NetworkFetcher() override;
29 30
30 private: 31 private:
31 const GURL& GetURL() const override; 32 const GURL& GetURL() const override;
32 GURL GetRedirectURL() const override; 33 GURL GetRedirectURL() const override;
(...skipping 26 matching lines...) Expand all
59 60
60 void OnLoadComplete(mojo::URLResponsePtr response); 61 void OnLoadComplete(mojo::URLResponsePtr response);
61 62
62 void OnFileSavedToCache(mojo::Array<uint8_t> path_as_array, 63 void OnFileSavedToCache(mojo::Array<uint8_t> path_as_array,
63 mojo::Array<uint8_t> cache_dir); 64 mojo::Array<uint8_t> cache_dir);
64 65
65 static void RecordCacheToURLMapping(const base::FilePath& path, 66 static void RecordCacheToURLMapping(const base::FilePath& path,
66 const GURL& url); 67 const GURL& url);
67 68
68 const bool disable_cache_; 69 const bool disable_cache_;
70 const bool force_offline_by_default_;
69 const GURL url_; 71 const GURL url_;
70 mojo::URLResponseDiskCache* url_response_disk_cache_; 72 mojo::URLResponseDiskCache* url_response_disk_cache_;
71 mojo::NetworkService* network_service_; 73 mojo::NetworkService* network_service_;
72 mojo::URLLoaderPtr url_loader_; 74 mojo::URLLoaderPtr url_loader_;
73 mojo::URLResponsePtr response_; 75 mojo::URLResponsePtr response_;
74 base::FilePath path_; 76 base::FilePath path_;
75 base::WeakPtrFactory<NetworkFetcher> weak_ptr_factory_; 77 base::WeakPtrFactory<NetworkFetcher> weak_ptr_factory_;
76 78
77 DISALLOW_COPY_AND_ASSIGN(NetworkFetcher); 79 DISALLOW_COPY_AND_ASSIGN(NetworkFetcher);
78 }; 80 };
79 81
80 } // namespace shell 82 } // namespace shell
81 83
82 #endif // SHELL_APPLICATION_MANAGER_NETWORK_FETCHER_H_ 84 #endif // SHELL_APPLICATION_MANAGER_NETWORK_FETCHER_H_
OLDNEW
« no previous file with comments | « shell/application_manager/application_manager.cc ('k') | shell/application_manager/network_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698