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

Side by Side Diff: content/browser/background_fetch/background_fetch_request_info.cc

Issue 2796933003: Store BackgroundFetchRequestInfo in a refcounted pointer (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/background_fetch/background_fetch_request_info.h" 5 #include "content/browser/background_fetch/background_fetch_request_info.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/browser/download_item.h" 9 #include "content/public/browser/download_item.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo() = default;
14
15 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo( 13 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo(
16 int request_index, 14 int request_index,
17 const ServiceWorkerFetchRequest& fetch_request) 15 const ServiceWorkerFetchRequest& fetch_request)
18 : request_index_(request_index), fetch_request_(fetch_request) {} 16 : request_index_(request_index), fetch_request_(fetch_request) {}
19 17
20 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo(
21 const BackgroundFetchRequestInfo& request)
22 : request_index_(request.request_index_),
23 fetch_request_(request.fetch_request_),
24 download_guid_(request.download_guid_),
25 state_(request.state_),
26 interrupt_reason_(request.interrupt_reason_),
27 file_path_(request.file_path_),
28 received_bytes_(request.received_bytes_) {}
29
30 BackgroundFetchRequestInfo::~BackgroundFetchRequestInfo() {} 18 BackgroundFetchRequestInfo::~BackgroundFetchRequestInfo() {}
31 19
32 bool BackgroundFetchRequestInfo::IsComplete() const { 20 bool BackgroundFetchRequestInfo::IsComplete() const {
33 return (state_ == DownloadItem::DownloadState::COMPLETE || 21 return (state_ == DownloadItem::DownloadState::COMPLETE ||
34 state_ == DownloadItem::DownloadState::CANCELLED); 22 state_ == DownloadItem::DownloadState::CANCELLED);
35 } 23 }
36 24
37 const GURL& BackgroundFetchRequestInfo::GetURL() const { 25 const GURL& BackgroundFetchRequestInfo::GetURL() const {
38 return fetch_request_.url; 26 return fetch_request_.url;
39 } 27 }
40 28
41 } // namespace content 29 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698