OLD | NEW |
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 "webkit/appcache/appcache_storage.h" | 5 #include "webkit/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 "webkit/appcache/appcache_response.h" | 10 #include "webkit/appcache/appcache_response.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 AppCacheStorage::ResponseInfoLoadTask::~ResponseInfoLoadTask() { | 56 AppCacheStorage::ResponseInfoLoadTask::~ResponseInfoLoadTask() { |
57 } | 57 } |
58 | 58 |
59 void AppCacheStorage::ResponseInfoLoadTask::StartIfNeeded() { | 59 void AppCacheStorage::ResponseInfoLoadTask::StartIfNeeded() { |
60 if (reader_) | 60 if (reader_) |
61 return; | 61 return; |
62 reader_.reset( | 62 reader_.reset( |
63 storage_->CreateResponseReader(manifest_url_, group_id_, response_id_)); | 63 storage_->CreateResponseReader(manifest_url_, group_id_, response_id_)); |
64 reader_->ReadInfo( | 64 reader_->ReadInfo(info_buffer_.get(), |
65 info_buffer_, base::Bind(&ResponseInfoLoadTask::OnReadComplete, | 65 base::Bind(&ResponseInfoLoadTask::OnReadComplete, |
66 base::Unretained(this))); | 66 base::Unretained(this))); |
67 } | 67 } |
68 | 68 |
69 void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) { | 69 void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) { |
70 storage_->pending_info_loads_.erase(response_id_); | 70 storage_->pending_info_loads_.erase(response_id_); |
71 scoped_refptr<AppCacheResponseInfo> info; | 71 scoped_refptr<AppCacheResponseInfo> info; |
72 if (result >= 0) { | 72 if (result >= 0) { |
73 info = new AppCacheResponseInfo(storage_->service(), manifest_url_, | 73 info = new AppCacheResponseInfo(storage_->service(), manifest_url_, |
74 response_id_, | 74 response_id_, |
75 info_buffer_->http_info.release(), | 75 info_buffer_->http_info.release(), |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void AppCacheStorage::NotifyStorageAccessed(const GURL& origin) { | 127 void AppCacheStorage::NotifyStorageAccessed(const GURL& origin) { |
128 if (service()->quota_manager_proxy() && | 128 if (service()->quota_manager_proxy() && |
129 usage_map_.find(origin) != usage_map_.end()) | 129 usage_map_.find(origin) != usage_map_.end()) |
130 service()->quota_manager_proxy()->NotifyStorageAccessed( | 130 service()->quota_manager_proxy()->NotifyStorageAccessed( |
131 quota::QuotaClient::kAppcache, | 131 quota::QuotaClient::kAppcache, |
132 origin, quota::kStorageTypeTemporary); | 132 origin, quota::kStorageTypeTemporary); |
133 } | 133 } |
134 | 134 |
135 } // namespace appcache | 135 } // namespace appcache |
136 | 136 |
OLD | NEW |