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

Side by Side Diff: content/browser/cache_storage/cache_storage_dispatcher_host.cc

Issue 1108273002: Add Client Attribute to FetchEvent- Chromium Side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/cache_storage/cache_storage_dispatcher_host.h" 5 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 int request_id, 151 int request_id,
152 const GURL& origin, 152 const GURL& origin,
153 const ServiceWorkerFetchRequest& request, 153 const ServiceWorkerFetchRequest& request,
154 const CacheStorageCacheQueryParams& match_params) { 154 const CacheStorageCacheQueryParams& match_params) {
155 TRACE_EVENT0("CacheStorage", 155 TRACE_EVENT0("CacheStorage",
156 "CacheStorageDispatcherHost::OnCacheStorageMatch"); 156 "CacheStorageDispatcherHost::OnCacheStorageMatch");
157 157
158 scoped_ptr<ServiceWorkerFetchRequest> scoped_request( 158 scoped_ptr<ServiceWorkerFetchRequest> scoped_request(
159 new ServiceWorkerFetchRequest(request.url, request.method, 159 new ServiceWorkerFetchRequest(request.url, request.method,
160 request.headers, request.referrer, 160 request.headers, request.referrer,
161 request.is_reload)); 161 request.is_reload, request.client));
162 162
163 if (match_params.cache_name.empty()) { 163 if (match_params.cache_name.empty()) {
164 context_->cache_manager()->MatchAllCaches( 164 context_->cache_manager()->MatchAllCaches(
165 origin, scoped_request.Pass(), 165 origin, scoped_request.Pass(),
166 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, 166 base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback,
167 this, thread_id, request_id)); 167 this, thread_id, request_id));
168 return; 168 return;
169 } 169 }
170 context_->cache_manager()->MatchCache( 170 context_->cache_manager()->MatchCache(
171 origin, base::UTF16ToUTF8(match_params.cache_name), scoped_request.Pass(), 171 origin, base::UTF16ToUTF8(match_params.cache_name), scoped_request.Pass(),
(...skipping 11 matching lines...) Expand all
183 if (it == id_to_cache_map_.end()) { 183 if (it == id_to_cache_map_.end()) {
184 Send(new CacheStorageMsg_CacheMatchError( 184 Send(new CacheStorageMsg_CacheMatchError(
185 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); 185 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound));
186 return; 186 return;
187 } 187 }
188 188
189 scoped_refptr<CacheStorageCache> cache = it->second; 189 scoped_refptr<CacheStorageCache> cache = it->second;
190 scoped_ptr<ServiceWorkerFetchRequest> scoped_request( 190 scoped_ptr<ServiceWorkerFetchRequest> scoped_request(
191 new ServiceWorkerFetchRequest(request.url, request.method, 191 new ServiceWorkerFetchRequest(request.url, request.method,
192 request.headers, request.referrer, 192 request.headers, request.referrer,
193 request.is_reload)); 193 request.is_reload, request.client));
194 cache->Match(scoped_request.Pass(), 194 cache->Match(scoped_request.Pass(),
195 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, 195 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback,
196 this, thread_id, request_id, cache)); 196 this, thread_id, request_id, cache));
197 } 197 }
198 198
199 void CacheStorageDispatcherHost::OnCacheMatchAll( 199 void CacheStorageDispatcherHost::OnCacheMatchAll(
200 int thread_id, 200 int thread_id,
201 int request_id, 201 int request_id,
202 int cache_id, 202 int cache_id,
203 const ServiceWorkerFetchRequest& request, 203 const ServiceWorkerFetchRequest& request,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 Send(new CacheStorageMsg_CacheKeysError( 371 Send(new CacheStorageMsg_CacheKeysError(
372 thread_id, request_id, ToWebServiceWorkerCacheError(error))); 372 thread_id, request_id, ToWebServiceWorkerCacheError(error)));
373 return; 373 return;
374 } 374 }
375 375
376 CacheStorageCache::Requests out; 376 CacheStorageCache::Requests out;
377 377
378 for (CacheStorageCache::Requests::const_iterator it = requests->begin(); 378 for (CacheStorageCache::Requests::const_iterator it = requests->begin();
379 it != requests->end(); ++it) { 379 it != requests->end(); ++it) {
380 ServiceWorkerFetchRequest request(it->url, it->method, it->headers, 380 ServiceWorkerFetchRequest request(it->url, it->method, it->headers,
381 it->referrer, it->is_reload); 381 it->referrer, it->is_reload, it->client);
382 out.push_back(request); 382 out.push_back(request);
383 } 383 }
384 384
385 Send(new CacheStorageMsg_CacheKeysSuccess(thread_id, request_id, out)); 385 Send(new CacheStorageMsg_CacheKeysSuccess(thread_id, request_id, out));
386 } 386 }
387 387
388 void CacheStorageDispatcherHost::OnCacheBatchCallback( 388 void CacheStorageDispatcherHost::OnCacheBatchCallback(
389 int thread_id, 389 int thread_id,
390 int request_id, 390 int request_id,
391 const scoped_refptr<CacheStorageCache>& cache, 391 const scoped_refptr<CacheStorageCache>& cache,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); 424 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid);
425 if (it == blob_handle_store_.end()) 425 if (it == blob_handle_store_.end())
426 return; 426 return;
427 DCHECK(!it->second.empty()); 427 DCHECK(!it->second.empty());
428 it->second.pop_front(); 428 it->second.pop_front();
429 if (it->second.empty()) 429 if (it->second.empty())
430 blob_handle_store_.erase(it); 430 blob_handle_store_.erase(it);
431 } 431 }
432 432
433 } // namespace content 433 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698