Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/appcache/appcache_navigation_handle_core.h" | |
| 6 | |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/bind.h" | |
| 10 #include "content/browser/appcache/appcache_dispatcher_host.h" | |
| 11 #include "content/browser/appcache/appcache_host.h" | |
| 12 #include "content/browser/appcache/appcache_navigation_handle.h" | |
| 13 #include "content/browser/appcache/appcache_service_impl.h" | |
| 14 #include "content/browser/appcache/chrome_appcache_service.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 AppCacheNavigationHandleCore::AppCacheNavigationHandleCore( | |
| 19 base::WeakPtr<AppCacheNavigationHandle> ui_handle, | |
| 20 ChromeAppCacheService* appcache_service, | |
| 21 int appcache_host_id) | |
| 22 : appcache_service_(appcache_service), | |
| 23 appcache_host_id_(appcache_host_id), | |
| 24 ui_handle_(ui_handle) { | |
| 25 // The AppCacheNavigationHandleCore is created on the UI thread but | |
| 26 // should only be accessed from the IO thread afterwards. | |
| 27 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 28 } | |
| 29 | |
| 30 AppCacheNavigationHandleCore::~AppCacheNavigationHandleCore() { | |
| 31 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 32 if (precreated_host_.get()) | |
|
michaeln
2016/12/03 00:58:58
is the test and reset call explicitly needed, std:
ananta
2016/12/03 14:55:04
Done.
| |
| 33 precreated_host_.reset(nullptr); | |
| 34 } | |
| 35 | |
| 36 void AppCacheNavigationHandleCore::Initialize() { | |
| 37 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 38 DCHECK(precreated_host_.get() == nullptr); | |
| 39 precreated_host_.reset( | |
| 40 new AppCacheHost(appcache_host_id_, this, GetAppCacheService())); | |
| 41 } | |
| 42 | |
| 43 void AppCacheNavigationHandleCore::CommitNavigation(int process_id) { | |
| 44 scoped_refptr<AppCacheDispatcherHost> dispatcher_host = | |
| 45 AppCacheDispatcherHost::GetHostForProcess(process_id); | |
|
michaeln
2016/12/03 00:58:58
ah... the map is accessed on the IO thread
Maybe
ananta
2016/12/03 14:55:04
The renderer process has not registered with the h
| |
| 46 // We release ownership of the precreated_host_ here. From this point on | |
| 47 // the AppCacheBackendImpl class owns the host. | |
| 48 if (dispatcher_host.get()) | |
| 49 dispatcher_host->RegisterPrecreatedHost(std::move(precreated_host_)); | |
| 50 } | |
| 51 | |
| 52 AppCacheServiceImpl* AppCacheNavigationHandleCore::GetAppCacheService() { | |
| 53 return static_cast<AppCacheServiceImpl*>(appcache_service_.get()); | |
| 54 } | |
| 55 | |
| 56 void AppCacheNavigationHandleCore::OnCacheSelected(int host_id, | |
| 57 const AppCacheInfo& info) { | |
| 58 DCHECK(false); | |
| 59 } | |
| 60 | |
| 61 void AppCacheNavigationHandleCore::OnStatusChanged( | |
| 62 const std::vector<int>& host_ids, | |
| 63 AppCacheStatus status) { | |
| 64 // Should never be called. | |
| 65 DCHECK(false); | |
| 66 } | |
| 67 | |
| 68 void AppCacheNavigationHandleCore::OnEventRaised( | |
| 69 const std::vector<int>& host_ids, | |
| 70 AppCacheEventID event_id) { | |
| 71 // Should never be called. | |
| 72 DCHECK(false); | |
| 73 } | |
| 74 | |
| 75 void AppCacheNavigationHandleCore::OnProgressEventRaised( | |
| 76 const std::vector<int>& host_ids, | |
| 77 const GURL& url, | |
| 78 int num_total, | |
| 79 int num_complete) { | |
| 80 // Should never be called. | |
| 81 DCHECK(false); | |
| 82 } | |
| 83 | |
| 84 void AppCacheNavigationHandleCore::OnErrorEventRaised( | |
| 85 const std::vector<int>& host_ids, | |
| 86 const AppCacheErrorDetails& details) { | |
| 87 // Should never be called. | |
| 88 DCHECK(false); | |
| 89 } | |
| 90 | |
| 91 void AppCacheNavigationHandleCore::OnLogMessage(int host_id, | |
| 92 AppCacheLogLevel log_level, | |
| 93 const std::string& message) { | |
| 94 // Should never be called. | |
| 95 DCHECK(false); | |
| 96 } | |
| 97 | |
| 98 void AppCacheNavigationHandleCore::OnContentBlocked(int host_id, | |
| 99 const GURL& manifest_url) { | |
| 100 // Should never be called. | |
| 101 DCHECK(false); | |
| 102 } | |
| 103 | |
| 104 } // namespace content | |
| OLD | NEW |