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

Side by Side Diff: content/browser/appcache/appcache_host.cc

Issue 2815913005: Switch to using scoped_ptr with UserData (Closed)
Patch Set: rebase Created 3 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/appcache/appcache_host.h" 5 #include "content/browser/appcache/appcache_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
10 #include "content/browser/appcache/appcache.h" 11 #include "content/browser/appcache/appcache.h"
11 #include "content/browser/appcache/appcache_backend_impl.h" 12 #include "content/browser/appcache/appcache_backend_impl.h"
12 #include "content/browser/appcache/appcache_policy.h" 13 #include "content/browser/appcache/appcache_policy.h"
13 #include "content/browser/appcache/appcache_request_handler.h" 14 #include "content/browser/appcache/appcache_request_handler.h"
14 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
15 #include "storage/browser/quota/quota_manager_proxy.h" 16 #include "storage/browser/quota/quota_manager_proxy.h"
16 17
17 namespace content { 18 namespace content {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 AppCacheBackendImpl* backend = service_->GetBackend(spawning_process_id_); 304 AppCacheBackendImpl* backend = service_->GetBackend(spawning_process_id_);
304 return backend ? backend->GetHost(spawning_host_id_) : NULL; 305 return backend ? backend->GetHost(spawning_host_id_) : NULL;
305 } 306 }
306 307
307 AppCacheHost* AppCacheHost::GetParentAppCacheHost() const { 308 AppCacheHost* AppCacheHost::GetParentAppCacheHost() const {
308 DCHECK(is_for_dedicated_worker()); 309 DCHECK(is_for_dedicated_worker());
309 AppCacheBackendImpl* backend = service_->GetBackend(parent_process_id_); 310 AppCacheBackendImpl* backend = service_->GetBackend(parent_process_id_);
310 return backend ? backend->GetHost(parent_host_id_) : NULL; 311 return backend ? backend->GetHost(parent_host_id_) : NULL;
311 } 312 }
312 313
313 AppCacheRequestHandler* AppCacheHost::CreateRequestHandler( 314 std::unique_ptr<AppCacheRequestHandler> AppCacheHost::CreateRequestHandler(
314 net::URLRequest* request, 315 net::URLRequest* request,
315 ResourceType resource_type, 316 ResourceType resource_type,
316 bool should_reset_appcache) { 317 bool should_reset_appcache) {
317 if (is_for_dedicated_worker()) { 318 if (is_for_dedicated_worker()) {
318 AppCacheHost* parent_host = GetParentAppCacheHost(); 319 AppCacheHost* parent_host = GetParentAppCacheHost();
319 if (parent_host) 320 if (parent_host)
320 return parent_host->CreateRequestHandler( 321 return parent_host->CreateRequestHandler(
321 request, resource_type, should_reset_appcache); 322 request, resource_type, should_reset_appcache);
322 return NULL; 323 return NULL;
323 } 324 }
324 325
325 if (AppCacheRequestHandler::IsMainResourceType(resource_type)) { 326 if (AppCacheRequestHandler::IsMainResourceType(resource_type)) {
326 // Store the first party origin so that it can be used later in SelectCache 327 // Store the first party origin so that it can be used later in SelectCache
327 // for checking whether the creation of the appcache is allowed. 328 // for checking whether the creation of the appcache is allowed.
328 first_party_url_ = request->first_party_for_cookies(); 329 first_party_url_ = request->first_party_for_cookies();
329 return new AppCacheRequestHandler( 330 return base::WrapUnique(
330 this, resource_type, should_reset_appcache); 331 new AppCacheRequestHandler(this, resource_type, should_reset_appcache));
331 } 332 }
332 333
333 if ((associated_cache() && associated_cache()->is_complete()) || 334 if ((associated_cache() && associated_cache()->is_complete()) ||
334 is_selection_pending()) { 335 is_selection_pending()) {
335 return new AppCacheRequestHandler( 336 return base::WrapUnique(
336 this, resource_type, should_reset_appcache); 337 new AppCacheRequestHandler(this, resource_type, should_reset_appcache));
337 } 338 }
338 return NULL; 339 return NULL;
339 } 340 }
340 341
341 void AppCacheHost::GetResourceList( 342 void AppCacheHost::GetResourceList(
342 AppCacheResourceInfoVector* resource_infos) { 343 AppCacheResourceInfoVector* resource_infos) {
343 if (associated_cache_.get() && associated_cache_->is_complete()) 344 if (associated_cache_.get() && associated_cache_->is_complete())
344 associated_cache_->ToResourceInfoVector(resource_infos); 345 associated_cache_->ToResourceInfoVector(resource_infos);
345 } 346 }
346 347
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 associated_cache_info_pending_ = cache && !cache->is_complete(); 570 associated_cache_info_pending_ = cache && !cache->is_complete();
570 AppCacheInfo info; 571 AppCacheInfo info;
571 if (cache) 572 if (cache)
572 cache->AssociateHost(this); 573 cache->AssociateHost(this);
573 574
574 FillCacheInfo(cache, manifest_url, GetStatus(), &info); 575 FillCacheInfo(cache, manifest_url, GetStatus(), &info);
575 frontend_->OnCacheSelected(host_id_, info); 576 frontend_->OnCacheSelected(host_id_, info);
576 } 577 }
577 578
578 } // namespace content 579 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_host.h ('k') | content/browser/appcache/appcache_interceptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698