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

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

Issue 2973233002: [Background Fetch] Cleanup/fix thread safety (Closed)
Patch Set: Remove n.b. from comments Created 3 years, 5 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_service_impl.h" 5 #include "content/browser/background_fetch/background_fetch_service_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/optional.h" 9 #include "base/optional.h"
10 #include "content/browser/background_fetch/background_fetch_context.h" 10 #include "content/browser/background_fetch/background_fetch_context.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 BackgroundFetchServiceImpl::BackgroundFetchServiceImpl( 46 BackgroundFetchServiceImpl::BackgroundFetchServiceImpl(
47 int render_process_id, 47 int render_process_id,
48 scoped_refptr<BackgroundFetchContext> background_fetch_context) 48 scoped_refptr<BackgroundFetchContext> background_fetch_context)
49 : render_process_id_(render_process_id), 49 : render_process_id_(render_process_id),
50 background_fetch_context_(std::move(background_fetch_context)) { 50 background_fetch_context_(std::move(background_fetch_context)) {
51 DCHECK(background_fetch_context_); 51 DCHECK(background_fetch_context_);
52 } 52 }
53 53
54 BackgroundFetchServiceImpl::~BackgroundFetchServiceImpl() = default; 54 BackgroundFetchServiceImpl::~BackgroundFetchServiceImpl() {
55 DCHECK_CURRENTLY_ON(BrowserThread::IO);
56 }
55 57
56 void BackgroundFetchServiceImpl::Fetch( 58 void BackgroundFetchServiceImpl::Fetch(
57 int64_t service_worker_registration_id, 59 int64_t service_worker_registration_id,
58 const url::Origin& origin, 60 const url::Origin& origin,
59 const std::string& tag, 61 const std::string& tag,
60 const std::vector<ServiceWorkerFetchRequest>& requests, 62 const std::vector<ServiceWorkerFetchRequest>& requests,
61 const BackgroundFetchOptions& options, 63 const BackgroundFetchOptions& options,
62 FetchCallback callback) { 64 FetchCallback callback) {
63 DCHECK_CURRENTLY_ON(BrowserThread::IO); 65 DCHECK_CURRENTLY_ON(BrowserThread::IO);
64 if (!ValidateTag(tag)) { 66 if (!ValidateTag(tag)) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (title.empty() || title.size() > kMaxTitleLength) { 202 if (title.empty() || title.size() > kMaxTitleLength) {
201 bad_message::ReceivedBadMessage(render_process_id_, 203 bad_message::ReceivedBadMessage(render_process_id_,
202 bad_message::BFSI_INVALID_TITLE); 204 bad_message::BFSI_INVALID_TITLE);
203 return false; 205 return false;
204 } 206 }
205 207
206 return true; 208 return true;
207 } 209 }
208 210
209 } // namespace content 211 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698