OLD | NEW |
(Empty) | |
| 1 // Copyright 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/background_fetch/background_fetch_data_manager.h" |
| 6 |
| 7 #include "content/browser/background_fetch/background_fetch_context.h" |
| 8 #include "content/browser/background_fetch/fetch_request.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 BackgroundFetchDataManager::BackgroundFetchDataManager( |
| 13 BackgroundFetchContext* background_fetch_context) |
| 14 : background_fetch_context_(background_fetch_context) { |
| 15 DCHECK(background_fetch_context_); |
| 16 // TODO(harkness) Read from persistent storage and recreate requests. |
| 17 } |
| 18 |
| 19 BackgroundFetchDataManager::~BackgroundFetchDataManager() {} |
| 20 |
| 21 void BackgroundFetchDataManager::CreateRequest( |
| 22 const FetchRequest& fetch_request) { |
| 23 FetchIdentifier id(fetch_request.service_worker_registration_id(), |
| 24 fetch_request.tag()); |
| 25 if (fetch_map_.find(id) != fetch_map_.end()) { |
| 26 DLOG(ERROR) << "Origin " << fetch_request.origin() |
| 27 << " has already created a fetch request with tag " |
| 28 << fetch_request.tag(); |
| 29 // TODO(harkness) Figure out how to return errors like this. |
| 30 return; |
| 31 } |
| 32 fetch_map_[id] = fetch_request; |
| 33 } |
| 34 |
| 35 } // namespace content |
OLD | NEW |