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

Unified Diff: content/browser/background_fetch/background_fetch_data_manager.cc

Issue 2678273003: Initial framework setup and skeleton for BackgroundFetchContext (Closed)
Patch Set: Removed unused browser_context_ stored member. Created 3 years, 10 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/background_fetch/background_fetch_data_manager.cc
diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..06a82d4d31bbe50e3dc5b571bb0faabaf35dac1e
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_data_manager.cc
@@ -0,0 +1,35 @@
+// Copyright 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/background_fetch/background_fetch_data_manager.h"
+
+#include "content/browser/background_fetch/background_fetch_context.h"
+#include "content/browser/background_fetch/fetch_request.h"
+
+namespace content {
+
+BackgroundFetchDataManager::BackgroundFetchDataManager(
+ BackgroundFetchContext* background_fetch_context)
+ : background_fetch_context_(background_fetch_context) {
+ DCHECK(background_fetch_context_);
+ // TODO(harkness) Read from persistent storage and recreate requests.
+}
+
+BackgroundFetchDataManager::~BackgroundFetchDataManager() {}
+
+void BackgroundFetchDataManager::CreateRequest(
+ const FetchRequest& fetch_request) {
+ FetchIdentifier id(fetch_request.service_worker_registration_id(),
+ fetch_request.tag());
+ if (fetch_map_.find(id) != fetch_map_.end()) {
+ DLOG(ERROR) << "Origin " << fetch_request.origin()
+ << " has already created a fetch request with tag "
+ << fetch_request.tag();
+ // TODO(harkness) Figure out how to return errors like this.
+ return;
+ }
+ fetch_map_[id] = fetch_request;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698