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

Unified Diff: net/tools/dump_cache/upgrade.cc

Issue 2869005: Disk Cache: Remove deprecated methods from the disk cache interface.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/dump_cache/cache_dumper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/dump_cache/upgrade.cc
===================================================================
--- net/tools/dump_cache/upgrade.cc (revision 49819)
+++ net/tools/dump_cache/upgrade.cc (working copy)
@@ -210,6 +210,8 @@
MasterSM(const std::wstring& path, HANDLE channel, bool dump_to_disk)
: BaseSM(channel), path_(path), dump_to_disk_(dump_to_disk),
ALLOW_THIS_IN_INITIALIZER_LIST(
+ create_callback_(this, &MasterSM::DoCreateEntryComplete)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(
write_callback_(this, &MasterSM::DoReadDataComplete)) {
}
virtual ~MasterSM() {
@@ -236,6 +238,7 @@
void SendGetPrevEntry();
void DoGetEntry();
void DoGetKey(int bytes_read);
+ void DoCreateEntryComplete(int result);
void DoGetUseTimes();
void SendGetDataSize();
void DoGetDataSize();
@@ -259,6 +262,7 @@
CacheDumpWriter* writer_;
const std::wstring& path_;
bool dump_to_disk_;
+ net::CompletionCallbackImpl<MasterSM> create_callback_;
net::CompletionCallbackImpl<MasterSM> write_callback_;
};
@@ -388,8 +392,17 @@
std::string key(input_->buffer);
DCHECK(key.size() == static_cast<size_t>(input_->msg.buffer_bytes - 1));
- if (!writer_->CreateEntry(key,
- reinterpret_cast<disk_cache::Entry**>(&entry_))) {
+ int rv = writer_->CreateEntry(key,
+ reinterpret_cast<disk_cache::Entry**>(&entry_),
+ &create_callback_);
+
+ if (rv != net::ERR_IO_PENDING)
+ DoCreateEntryComplete(rv);
+}
+
+void MasterSM::DoCreateEntryComplete(int result) {
+ std::string key(input_->buffer);
+ if (result != net::OK) {
printf("Skipping entry \"%s\": %d\n", key.c_str(), GetLastError());
return SendGetPrevEntry();
}
« no previous file with comments | « net/tools/dump_cache/cache_dumper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698