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

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

Issue 2881010: Revert 51456 - Disk cache: Switch the disk cache to use the cache_thread.... (Closed) Base URL: svn://svn.chromium.org/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/crash_cache/crash_cache.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 51468)
+++ net/tools/dump_cache/upgrade.cc (working copy)
@@ -104,8 +104,7 @@
RESULT_OK = 0,
RESULT_UNKNOWN_COMMAND,
RESULT_INVALID_PARAMETER,
- RESULT_NAME_OVERFLOW,
- RESULT_PENDING // This error code is NOT expected by the master process.
+ RESULT_NAME_OVERFLOW
};
// -----------------------------------------------------------------------
@@ -576,7 +575,6 @@
void DoGetNextEntry();
void DoGetPrevEntry();
int32 GetEntryFromList();
- void DoGetEntryComplete(int result);
void DoCloseEntry();
void DoGetKey();
void DoGetUseTimes();
@@ -587,19 +585,16 @@
void Fail();
void* iterator_;
- Message msg_; // Used for DoReadDataComplete and DoGetEntryComplete.
+ Message msg_; // Only used for DoReadDataComplete.
net::CompletionCallbackImpl<SlaveSM> read_callback_;
- net::CompletionCallbackImpl<SlaveSM> next_callback_;
scoped_ptr<disk_cache::BackendImpl> cache_;
};
SlaveSM::SlaveSM(const std::wstring& path, HANDLE channel)
: BaseSM(channel), iterator_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(
- read_callback_(this, &SlaveSM::DoReadDataComplete)),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- next_callback_(this, &SlaveSM::DoGetEntryComplete)) {
+ read_callback_(this, &SlaveSM::DoReadDataComplete)) {
disk_cache::Backend* cache;
TestCompletionCallback cb;
int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE,
@@ -677,9 +672,6 @@
DEBUGMSG("\t\t\tSlave DoInit\n");
DCHECK(state_ == SLAVE_INITIAL);
state_ = SLAVE_WAITING;
- if (!cache_.get())
- return false;
-
return ReceiveMsg();
}
@@ -708,11 +700,6 @@
msg.result = RESULT_UNKNOWN_COMMAND;
} else {
msg.result = GetEntryFromList();
- if (msg.result == RESULT_PENDING) {
- // We are not done yet.
- msg_ = msg;
- return;
- }
msg.long_arg1 = reinterpret_cast<int64>(entry_);
}
SendMsg(msg);
@@ -728,31 +715,23 @@
if (entry_)
entry_->Close();
- int rv;
+ bool ret;
if (input_->msg.command == GET_NEXT_ENTRY) {
- rv = cache_->OpenNextEntry(&iterator_,
- reinterpret_cast<disk_cache::Entry**>(&entry_),
- &next_callback_);
+ ret = cache_->OpenNextEntry(&iterator_,
+ reinterpret_cast<disk_cache::Entry**>(&entry_));
} else {
DCHECK(input_->msg.command == GET_PREV_ENTRY);
- rv = cache_->OpenPrevEntry(&iterator_,
- reinterpret_cast<disk_cache::Entry**>(&entry_),
- &next_callback_);
+ ret = cache_->OpenPrevEntry(&iterator_,
+ reinterpret_cast<disk_cache::Entry**>(&entry_));
}
- DCHECK_EQ(net::ERR_IO_PENDING, rv);
- return RESULT_PENDING;
-}
-void SlaveSM::DoGetEntryComplete(int result) {
- DEBUGMSG("\t\t\tSlave DoGetEntryComplete\n");
- if (result != net::OK) {
+ if (!ret)
entry_ = NULL;
+
+ if (!entry_)
DEBUGMSG("\t\t\tSlave end of list\n");
- }
- msg_.result = RESULT_OK;
- msg_.long_arg1 = reinterpret_cast<int64>(entry_);
- SendMsg(msg_);
+ return RESULT_OK;
}
void SlaveSM::DoCloseEntry() {
« no previous file with comments | « net/tools/crash_cache/crash_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698