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

Side by Side Diff: content/browser/appcache/appcache_job.cc

Issue 2865613002: Add an abstraction for a job in the AppCacheRequestHandler class. (Closed)
Patch Set: Fix build failures Created 3 years, 7 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
(Empty)
1 // Copyright (c) 2017 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 "content/browser/appcache/appcache_job.h"
6 #include "content/browser/appcache/appcache_request.h"
7 #include "content/browser/appcache/appcache_url_loader_job.h"
8 #include "content/browser/appcache/appcache_url_request_job.h"
9
10 namespace content {
11
12 std::unique_ptr<AppCacheJob> AppCacheJob::Create(
13 kJobType job_type,
14 bool is_main_resource,
15 AppCacheHost* host,
16 AppCacheStorage* storage,
17 AppCacheRequest* request,
18 net::NetworkDelegate* network_delegate,
19 const OnPrepareToRestartCallback& restart_callback) {
20 std::unique_ptr<AppCacheJob> job;
21 if (job_type == kJobType::URL_REQUEST_JOB) {
22 job.reset(new AppCacheURLRequestJob(request->GetURLRequest(),
23 network_delegate, storage, host,
24 is_main_resource, restart_callback));
25 } else if (job_type == kJobType::URL_LOADER_JOB) {
26 job.reset(new AppCacheURLLoaderJob);
27 } else {
28 NOTREACHED();
29 }
30 return job;
31 }
32
33 AppCacheJob::~AppCacheJob() {}
34
35 base::WeakPtr<AppCacheJob> AppCacheJob::GetWeakPtr() {
36 return weak_factory_.GetWeakPtr();
37 }
38
39 net::URLRequestJob* AppCacheJob::AsURLRequestJob() {
40 return nullptr;
41 }
42
43 AppCacheJob::AppCacheJob() : weak_factory_(this) {}
44
45 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698