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

Unified Diff: content/browser/appcache/appcache_job.cc

Issue 2865613002: Add an abstraction for a job in the AppCacheRequestHandler class. (Closed)
Patch Set: Fix compile 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/appcache/appcache_job.h ('k') | content/browser/appcache/appcache_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/appcache_job.cc
diff --git a/content/browser/appcache/appcache_job.cc b/content/browser/appcache/appcache_job.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0666c926811dbdb7047fb8e0fbef6f4d09854e37
--- /dev/null
+++ b/content/browser/appcache/appcache_job.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2017 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.
+
+#include "content/browser/appcache/appcache_job.h"
+
+#include "base/command_line.h"
+#include "content/browser/appcache/appcache_request.h"
+#include "content/browser/appcache/appcache_url_loader_job.h"
+#include "content/browser/appcache/appcache_url_request_job.h"
+
+#include "content/public/common/content_switches.h"
+
+namespace content {
+
+std::unique_ptr<AppCacheJob> AppCacheJob::Create(
+ bool is_main_resource,
+ AppCacheHost* host,
+ AppCacheStorage* storage,
+ AppCacheRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const OnPrepareToRestartCallback& restart_callback) {
+ std::unique_ptr<AppCacheJob> job;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNetworkService)) {
+ job.reset(new AppCacheURLLoaderJob);
+ } else {
+ job.reset(new AppCacheURLRequestJob(request->GetURLRequest(),
+ network_delegate, storage, host,
+ is_main_resource, restart_callback));
+ }
+ return job;
+}
+
+AppCacheJob::~AppCacheJob() {}
+
+base::WeakPtr<AppCacheJob> AppCacheJob::GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
+net::URLRequestJob* AppCacheJob::AsURLRequestJob() {
+ return nullptr;
+}
+
+AppCacheJob::AppCacheJob() : weak_factory_(this) {}
+
+} // namespace content
« no previous file with comments | « content/browser/appcache/appcache_job.h ('k') | content/browser/appcache/appcache_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698