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

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

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX Created 5 years 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_storage.h" 5 #include "content/browser/appcache/appcache_storage.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/appcache/appcache_response.h" 10 #include "content/browser/appcache/appcache_response.h"
11 #include "content/browser/appcache/appcache_service_impl.h" 11 #include "content/browser/appcache/appcache_service_impl.h"
12 #include "storage/browser/quota/quota_client.h" 12 #include "storage/browser/quota/quota_client.h"
13 #include "storage/browser/quota/quota_manager_proxy.h" 13 #include "storage/browser/quota/quota_manager_proxy.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 // static 17 // static
18 const int64 AppCacheStorage::kUnitializedId = -1; 18 const int64_t AppCacheStorage::kUnitializedId = -1;
19 19
20 AppCacheStorage::AppCacheStorage(AppCacheServiceImpl* service) 20 AppCacheStorage::AppCacheStorage(AppCacheServiceImpl* service)
21 : last_cache_id_(kUnitializedId), last_group_id_(kUnitializedId), 21 : last_cache_id_(kUnitializedId), last_group_id_(kUnitializedId),
22 last_response_id_(kUnitializedId), service_(service) { 22 last_response_id_(kUnitializedId), service_(service) {
23 } 23 }
24 24
25 AppCacheStorage::~AppCacheStorage() { 25 AppCacheStorage::~AppCacheStorage() {
26 STLDeleteValues(&pending_info_loads_); 26 STLDeleteValues(&pending_info_loads_);
27 DCHECK(delegate_references_.empty()); 27 DCHECK(delegate_references_.empty());
28 } 28 }
29 29
30 AppCacheStorage::DelegateReference::DelegateReference( 30 AppCacheStorage::DelegateReference::DelegateReference(
31 Delegate* delegate, AppCacheStorage* storage) 31 Delegate* delegate, AppCacheStorage* storage)
32 : delegate(delegate), storage(storage) { 32 : delegate(delegate), storage(storage) {
33 storage->delegate_references_.insert( 33 storage->delegate_references_.insert(
34 DelegateReferenceMap::value_type(delegate, this)); 34 DelegateReferenceMap::value_type(delegate, this));
35 } 35 }
36 36
37 AppCacheStorage::DelegateReference::~DelegateReference() { 37 AppCacheStorage::DelegateReference::~DelegateReference() {
38 if (delegate) 38 if (delegate)
39 storage->delegate_references_.erase(delegate); 39 storage->delegate_references_.erase(delegate);
40 } 40 }
41 41
42 AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask( 42 AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask(
43 const GURL& manifest_url, 43 const GURL& manifest_url,
44 int64 group_id, 44 int64_t group_id,
45 int64 response_id, 45 int64_t response_id,
46 AppCacheStorage* storage) 46 AppCacheStorage* storage)
47 : storage_(storage), 47 : storage_(storage),
48 manifest_url_(manifest_url), 48 manifest_url_(manifest_url),
49 group_id_(group_id), 49 group_id_(group_id),
50 response_id_(response_id), 50 response_id_(response_id),
51 info_buffer_(new HttpResponseInfoIOBuffer) { 51 info_buffer_(new HttpResponseInfoIOBuffer) {
52 storage_->pending_info_loads_.insert( 52 storage_->pending_info_loads_.insert(
53 PendingResponseInfoLoads::value_type(response_id, this)); 53 PendingResponseInfoLoads::value_type(response_id, this));
54 } 54 }
55 55
(...skipping 16 matching lines...) Expand all
72 if (result >= 0) { 72 if (result >= 0) {
73 info = new AppCacheResponseInfo(storage_, manifest_url_, 73 info = new AppCacheResponseInfo(storage_, manifest_url_,
74 response_id_, 74 response_id_,
75 info_buffer_->http_info.release(), 75 info_buffer_->http_info.release(),
76 info_buffer_->response_data_size); 76 info_buffer_->response_data_size);
77 } 77 }
78 FOR_EACH_DELEGATE(delegates_, OnResponseInfoLoaded(info.get(), response_id_)); 78 FOR_EACH_DELEGATE(delegates_, OnResponseInfoLoaded(info.get(), response_id_));
79 delete this; 79 delete this;
80 } 80 }
81 81
82 void AppCacheStorage::LoadResponseInfo( 82 void AppCacheStorage::LoadResponseInfo(const GURL& manifest_url,
83 const GURL& manifest_url, int64 group_id, int64 id, Delegate* delegate) { 83 int64_t group_id,
84 int64_t id,
85 Delegate* delegate) {
84 AppCacheResponseInfo* info = working_set_.GetResponseInfo(id); 86 AppCacheResponseInfo* info = working_set_.GetResponseInfo(id);
85 if (info) { 87 if (info) {
86 delegate->OnResponseInfoLoaded(info, id); 88 delegate->OnResponseInfoLoaded(info, id);
87 return; 89 return;
88 } 90 }
89 ResponseInfoLoadTask* info_load = 91 ResponseInfoLoadTask* info_load =
90 GetOrCreateResponseInfoLoadTask(manifest_url, group_id, id); 92 GetOrCreateResponseInfoLoadTask(manifest_url, group_id, id);
91 DCHECK(manifest_url == info_load->manifest_url()); 93 DCHECK(manifest_url == info_load->manifest_url());
92 DCHECK(group_id == info_load->group_id()); 94 DCHECK(group_id == info_load->group_id());
93 DCHECK(id == info_load->response_id()); 95 DCHECK(id == info_load->response_id());
94 info_load->AddDelegate(GetOrCreateDelegateReference(delegate)); 96 info_load->AddDelegate(GetOrCreateDelegateReference(delegate));
95 info_load->StartIfNeeded(); 97 info_load->StartIfNeeded();
96 } 98 }
97 99
98 void AppCacheStorage::UpdateUsageMapAndNotify( 100 void AppCacheStorage::UpdateUsageMapAndNotify(const GURL& origin,
99 const GURL& origin, int64 new_usage) { 101 int64_t new_usage) {
100 DCHECK_GE(new_usage, 0); 102 DCHECK_GE(new_usage, 0);
101 int64 old_usage = usage_map_[origin]; 103 int64_t old_usage = usage_map_[origin];
102 if (new_usage > 0) 104 if (new_usage > 0)
103 usage_map_[origin] = new_usage; 105 usage_map_[origin] = new_usage;
104 else 106 else
105 usage_map_.erase(origin); 107 usage_map_.erase(origin);
106 if (new_usage != old_usage && service()->quota_manager_proxy()) { 108 if (new_usage != old_usage && service()->quota_manager_proxy()) {
107 service()->quota_manager_proxy()->NotifyStorageModified( 109 service()->quota_manager_proxy()->NotifyStorageModified(
108 storage::QuotaClient::kAppcache, 110 storage::QuotaClient::kAppcache,
109 origin, 111 origin,
110 storage::kStorageTypeTemporary, 112 storage::kStorageTypeTemporary,
111 new_usage - old_usage); 113 new_usage - old_usage);
(...skipping 18 matching lines...) Expand all
130 if (service()->quota_manager_proxy() && 132 if (service()->quota_manager_proxy() &&
131 usage_map_.find(origin) != usage_map_.end()) 133 usage_map_.find(origin) != usage_map_.end())
132 service()->quota_manager_proxy()->NotifyStorageAccessed( 134 service()->quota_manager_proxy()->NotifyStorageAccessed(
133 storage::QuotaClient::kAppcache, 135 storage::QuotaClient::kAppcache,
134 origin, 136 origin,
135 storage::kStorageTypeTemporary); 137 storage::kStorageTypeTemporary);
136 } 138 }
137 139
138 } // namespace content 140 } // namespace content
139 141
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_storage.h ('k') | content/browser/appcache/appcache_storage_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698