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

Side by Side Diff: webkit/appcache/appcache_storage.cc

Issue 8991001: base::Bind: Convert most of webkit/appcache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix 2. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « webkit/appcache/appcache_storage.h ('k') | webkit/appcache/appcache_storage_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/appcache/appcache_storage.h" 5 #include "webkit/appcache/appcache_storage.h"
6 6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
7 #include "base/stl_util.h" 9 #include "base/stl_util.h"
8 #include "webkit/appcache/appcache_response.h" 10 #include "webkit/appcache/appcache_response.h"
9 #include "webkit/appcache/appcache_service.h" 11 #include "webkit/appcache/appcache_service.h"
10 #include "webkit/quota/quota_client.h" 12 #include "webkit/quota/quota_client.h"
11 #include "webkit/quota/quota_manager.h" 13 #include "webkit/quota/quota_manager.h"
12 14
13 namespace appcache { 15 namespace appcache {
14 16
15 // static 17 // static
16 const int64 AppCacheStorage::kUnitializedId = -1; 18 const int64 AppCacheStorage::kUnitializedId = -1;
(...skipping 22 matching lines...) Expand all
39 41
40 AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask( 42 AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask(
41 const GURL& manifest_url, 43 const GURL& manifest_url,
42 int64 group_id, 44 int64 group_id,
43 int64 response_id, 45 int64 response_id,
44 AppCacheStorage* storage) 46 AppCacheStorage* storage)
45 : storage_(storage), 47 : storage_(storage),
46 manifest_url_(manifest_url), 48 manifest_url_(manifest_url),
47 group_id_(group_id), 49 group_id_(group_id),
48 response_id_(response_id), 50 response_id_(response_id),
49 info_buffer_(new HttpResponseInfoIOBuffer), 51 info_buffer_(new HttpResponseInfoIOBuffer) {
50 ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_(
51 this, &ResponseInfoLoadTask::OnReadComplete)) {
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
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_.get()) 60 if (reader_.get())
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(info_buffer_, &read_callback_); 64 reader_->ReadInfo(
65 info_buffer_, base::Bind(&ResponseInfoLoadTask::OnReadComplete,
66 base::Unretained(this)));
65 } 67 }
66 68
67 void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) { 69 void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) {
68 storage_->pending_info_loads_.erase(response_id_); 70 storage_->pending_info_loads_.erase(response_id_);
69 scoped_refptr<AppCacheResponseInfo> info; 71 scoped_refptr<AppCacheResponseInfo> info;
70 if (result >= 0) { 72 if (result >= 0) {
71 info = new AppCacheResponseInfo(storage_->service(), manifest_url_, 73 info = new AppCacheResponseInfo(storage_->service(), manifest_url_,
72 response_id_, 74 response_id_,
73 info_buffer_->http_info.release(), 75 info_buffer_->http_info.release(),
74 info_buffer_->response_data_size); 76 info_buffer_->response_data_size);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void AppCacheStorage::NotifyStorageAccessed(const GURL& origin) { 127 void AppCacheStorage::NotifyStorageAccessed(const GURL& origin) {
126 if (service()->quota_manager_proxy() && 128 if (service()->quota_manager_proxy() &&
127 usage_map_.find(origin) != usage_map_.end()) 129 usage_map_.find(origin) != usage_map_.end())
128 service()->quota_manager_proxy()->NotifyStorageAccessed( 130 service()->quota_manager_proxy()->NotifyStorageAccessed(
129 quota::QuotaClient::kAppcache, 131 quota::QuotaClient::kAppcache,
130 origin, quota::kStorageTypeTemporary); 132 origin, quota::kStorageTypeTemporary);
131 } 133 }
132 134
133 } // namespace appcache 135 } // namespace appcache
134 136
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_storage.h ('k') | webkit/appcache/appcache_storage_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698