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

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

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tools/memory_watcher/memory_watcher.h ('k') | webkit/database/database_tracker.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_disk_cache.h" 5 #include "webkit/appcache/appcache_disk_cache.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_number_conversions.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 11
12 namespace appcache { 12 namespace appcache {
13 13
14 AppCacheDiskCache::AppCacheDiskCache() 14 AppCacheDiskCache::AppCacheDiskCache()
15 : is_disabled_(false), init_callback_(NULL) { 15 : is_disabled_(false), init_callback_(NULL) {
16 } 16 }
17 17
18 AppCacheDiskCache::~AppCacheDiskCache() { 18 AppCacheDiskCache::~AppCacheDiskCache() {
19 if (create_backend_callback_) { 19 if (create_backend_callback_) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return net::ERR_ABORTED; 55 return net::ERR_ABORTED;
56 56
57 if (is_initializing()) { 57 if (is_initializing()) {
58 pending_calls_.push_back(PendingCall(CREATE, key, entry, callback)); 58 pending_calls_.push_back(PendingCall(CREATE, key, entry, callback));
59 return net::ERR_IO_PENDING; 59 return net::ERR_IO_PENDING;
60 } 60 }
61 61
62 if (!disk_cache_.get()) 62 if (!disk_cache_.get())
63 return net::ERR_FAILED; 63 return net::ERR_FAILED;
64 64
65 return disk_cache_->CreateEntry(Int64ToString(key), entry, callback); 65 return disk_cache_->CreateEntry(base::Int64ToString(key), entry, callback);
66 } 66 }
67 67
68 int AppCacheDiskCache::OpenEntry(int64 key, disk_cache::Entry** entry, 68 int AppCacheDiskCache::OpenEntry(int64 key, disk_cache::Entry** entry,
69 net::CompletionCallback* callback) { 69 net::CompletionCallback* callback) {
70 if (is_disabled_) 70 if (is_disabled_)
71 return net::ERR_ABORTED; 71 return net::ERR_ABORTED;
72 72
73 if (is_initializing()) { 73 if (is_initializing()) {
74 pending_calls_.push_back(PendingCall(OPEN, key, entry, callback)); 74 pending_calls_.push_back(PendingCall(OPEN, key, entry, callback));
75 return net::ERR_IO_PENDING; 75 return net::ERR_IO_PENDING;
76 } 76 }
77 77
78 if (!disk_cache_.get()) 78 if (!disk_cache_.get())
79 return net::ERR_FAILED; 79 return net::ERR_FAILED;
80 80
81 return disk_cache_->OpenEntry(Int64ToString(key), entry, callback); 81 return disk_cache_->OpenEntry(base::Int64ToString(key), entry, callback);
82 } 82 }
83 83
84 int AppCacheDiskCache::DoomEntry(int64 key, 84 int AppCacheDiskCache::DoomEntry(int64 key,
85 net::CompletionCallback* callback) { 85 net::CompletionCallback* callback) {
86 if (is_disabled_) 86 if (is_disabled_)
87 return net::ERR_ABORTED; 87 return net::ERR_ABORTED;
88 88
89 if (is_initializing()) { 89 if (is_initializing()) {
90 pending_calls_.push_back(PendingCall(DOOM, key, NULL, callback)); 90 pending_calls_.push_back(PendingCall(DOOM, key, NULL, callback));
91 return net::ERR_IO_PENDING; 91 return net::ERR_IO_PENDING;
92 } 92 }
93 93
94 if (!disk_cache_.get()) 94 if (!disk_cache_.get())
95 return net::ERR_FAILED; 95 return net::ERR_FAILED;
96 96
97 return disk_cache_->DoomEntry(Int64ToString(key), callback); 97 return disk_cache_->DoomEntry(base::Int64ToString(key), callback);
98 } 98 }
99 99
100 int AppCacheDiskCache::Init(net::CacheType cache_type, 100 int AppCacheDiskCache::Init(net::CacheType cache_type,
101 const FilePath& cache_directory, 101 const FilePath& cache_directory,
102 int cache_size, bool force, 102 int cache_size, bool force,
103 base::MessageLoopProxy* cache_thread, 103 base::MessageLoopProxy* cache_thread,
104 net::CompletionCallback* callback) { 104 net::CompletionCallback* callback) {
105 DCHECK(!is_initializing() && !disk_cache_.get()); 105 DCHECK(!is_initializing() && !disk_cache_.get());
106 is_disabled_ = false; 106 is_disabled_ = false;
107 create_backend_callback_ = new CreateBackendCallback( 107 create_backend_callback_ = new CreateBackendCallback(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 break; 149 break;
150 } 150 }
151 if (rv != net::ERR_IO_PENDING) 151 if (rv != net::ERR_IO_PENDING)
152 iter->callback->Run(rv); 152 iter->callback->Run(rv);
153 } 153 }
154 pending_calls_.clear(); 154 pending_calls_.clear();
155 } 155 }
156 156
157 } // namespace appcache 157 } // namespace appcache
158 158
OLDNEW
« no previous file with comments | « tools/memory_watcher/memory_watcher.h ('k') | webkit/database/database_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698