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

Unified 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 side-by-side diff with in-line comments
Download patch
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..ec7d6ff357d323cff023d783ea369f367765d62b
--- /dev/null
+++ b/content/browser/appcache/appcache_job.cc
@@ -0,0 +1,45 @@
+// 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 "content/browser/appcache/appcache_request.h"
+#include "content/browser/appcache/appcache_url_loader_job.h"
+#include "content/browser/appcache/appcache_url_request_job.h"
+
+namespace content {
+
+std::unique_ptr<AppCacheJob> AppCacheJob::Create(
+ kJobType job_type,
+ bool is_main_resource,
+ AppCacheHost* host,
+ AppCacheStorage* storage,
+ AppCacheRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const OnPrepareToRestartCallback& restart_callback) {
+ std::unique_ptr<AppCacheJob> job;
+ if (job_type == kJobType::URL_REQUEST_JOB) {
+ job.reset(new AppCacheURLRequestJob(request->GetURLRequest(),
+ network_delegate, storage, host,
+ is_main_resource, restart_callback));
+ } else if (job_type == kJobType::URL_LOADER_JOB) {
+ job.reset(new AppCacheURLLoaderJob);
+ } else {
+ NOTREACHED();
+ }
+ 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

Powered by Google App Engine
This is Rietveld 408576698