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

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

Issue 2902653002: Get main frame and subframe AppCache loads to work. (Closed)
Patch Set: Address portions of the review comments Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_navigation_handle_core.h" 5 #include "content/browser/appcache/appcache_navigation_handle_core.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 AppCacheNavigationHandleCore::~AppCacheNavigationHandleCore() { 44 AppCacheNavigationHandleCore::~AppCacheNavigationHandleCore() {
45 DCHECK_CURRENTLY_ON(BrowserThread::IO); 45 DCHECK_CURRENTLY_ON(BrowserThread::IO);
46 precreated_host_.reset(nullptr); 46 precreated_host_.reset(nullptr);
47 g_appcache_handle_map.Get().erase(appcache_host_id_); 47 g_appcache_handle_map.Get().erase(appcache_host_id_);
48 } 48 }
49 49
50 void AppCacheNavigationHandleCore::Initialize() { 50 void AppCacheNavigationHandleCore::Initialize() {
51 DCHECK_CURRENTLY_ON(BrowserThread::IO); 51 DCHECK_CURRENTLY_ON(BrowserThread::IO);
52 DCHECK(precreated_host_.get() == nullptr); 52 DCHECK(precreated_host_.get() == nullptr);
53 precreated_host_.reset( 53 precreated_host_.reset(new AppCacheHost(
54 new AppCacheHost(appcache_host_id_, this, GetAppCacheService())); 54 appcache_host_id_, this,
55 static_cast<AppCacheServiceImpl*>(GetAppCacheService())));
55 56
56 DCHECK(g_appcache_handle_map.Get().find(appcache_host_id_) == 57 DCHECK(g_appcache_handle_map.Get().find(appcache_host_id_) ==
57 g_appcache_handle_map.Get().end()); 58 g_appcache_handle_map.Get().end());
58 g_appcache_handle_map.Get()[appcache_host_id_] = this; 59 g_appcache_handle_map.Get()[appcache_host_id_] = this;
59 } 60 }
60 61
61 // static 62 // static
62 std::unique_ptr<AppCacheHost> AppCacheNavigationHandleCore::GetPrecreatedHost( 63 std::unique_ptr<AppCacheHost> AppCacheNavigationHandleCore::GetPrecreatedHost(
63 int host_id) { 64 int host_id) {
64 DCHECK_CURRENTLY_ON(BrowserThread::IO); 65 DCHECK_CURRENTLY_ON(BrowserThread::IO);
65 auto index = g_appcache_handle_map.Get().find(host_id); 66 auto index = g_appcache_handle_map.Get().find(host_id);
66 if (index != g_appcache_handle_map.Get().end()) { 67 if (index != g_appcache_handle_map.Get().end()) {
67 AppCacheNavigationHandleCore* instance = index->second; 68 AppCacheNavigationHandleCore* instance = index->second;
68 DCHECK(instance); 69 DCHECK(instance);
69 return std::move(instance->precreated_host_); 70 return std::move(instance->precreated_host_);
70 } 71 }
71 return std::unique_ptr<AppCacheHost>(); 72 return std::unique_ptr<AppCacheHost>();
72 } 73 }
73 74
74 AppCacheServiceImpl* AppCacheNavigationHandleCore::GetAppCacheService() { 75 ChromeAppCacheService* AppCacheNavigationHandleCore::GetAppCacheService() {
75 return static_cast<AppCacheServiceImpl*>(appcache_service_.get()); 76 return appcache_service_.get();
76 } 77 }
77 78
78 void AppCacheNavigationHandleCore::OnCacheSelected(int host_id, 79 void AppCacheNavigationHandleCore::OnCacheSelected(int host_id,
79 const AppCacheInfo& info) { 80 const AppCacheInfo& info) {
80 DCHECK(false); 81 DCHECK(false);
81 } 82 }
82 83
83 void AppCacheNavigationHandleCore::OnStatusChanged( 84 void AppCacheNavigationHandleCore::OnStatusChanged(
84 const std::vector<int>& host_ids, 85 const std::vector<int>& host_ids,
85 AppCacheStatus status) { 86 AppCacheStatus status) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 DCHECK(false); 118 DCHECK(false);
118 } 119 }
119 120
120 void AppCacheNavigationHandleCore::OnContentBlocked(int host_id, 121 void AppCacheNavigationHandleCore::OnContentBlocked(int host_id,
121 const GURL& manifest_url) { 122 const GURL& manifest_url) {
122 // Should never be called. 123 // Should never be called.
123 DCHECK(false); 124 DCHECK(false);
124 } 125 }
125 126
126 } // namespace content 127 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698