Chromium Code Reviews| 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..f796fa0f932082644cf18f3d0134674f7acf6866 |
| --- /dev/null |
| +++ b/content/browser/background_fetch/background_fetch_data_manager.cc |
| @@ -0,0 +1,34 @@ |
| +// 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.origin(), fetch_request.tag()}; |
|
Peter Beverloo
2017/02/13 18:35:05
nit: I think you can drop the " = " and call the c
harkness
2017/02/14 13:52:46
Done.
|
| + 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 |