#include <list>
#include <string>
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/disk_cache/blockfile/in_flight_io.h"
+#include "net/disk_cache/blockfile/rankings.h"
namespace disk_cache {
void DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time);
void DoomEntriesSince(const base::Time initial_time);
- void OpenNextEntry(void** iter, Entry** next_entry);
- void OpenPrevEntry(void** iter, Entry** prev_entry);
- void EndEnumeration(void* iterator);
+ void OpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry);
+ void EndEnumeration(scoped_ptr<Rankings::Iterator> iterator);
void OnExternalCacheHit(const std::string& key);
void CloseEntryImpl(EntryImpl* entry);
void DoomEntryImpl(EntryImpl* entry);
OP_DOOM_BETWEEN,
OP_DOOM_SINCE,
OP_OPEN_NEXT,
- OP_OPEN_PREV,
OP_END_ENUMERATION,
OP_ON_EXTERNAL_CACHE_HIT,
OP_CLOSE_ENTRY,
Entry** entry_ptr_;
base::Time initial_time_;
base::Time end_time_;
- void** iter_ptr_;
- void* iter_;
+ Rankings::Iterator* iterator_;
+ scoped_ptr<Rankings::Iterator> scoped_iterator_;
EntryImpl* entry_;
int index_;
int offset_;
// The specialized controller that keeps track of current operations.
class InFlightBackendIO : public InFlightIO {
public:
- InFlightBackendIO(BackendImpl* backend,
- base::MessageLoopProxy* background_thread);
+ InFlightBackendIO(
+ BackendImpl* backend,
+ const scoped_refptr<base::SingleThreadTaskRunner>& background_thread);
virtual ~InFlightBackendIO();
// Proxied operations.
const net::CompletionCallback& callback);
void DoomEntriesSince(const base::Time initial_time,
const net::CompletionCallback& callback);
- void OpenNextEntry(void** iter, Entry** next_entry,
+ void OpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry,
const net::CompletionCallback& callback);
- void OpenPrevEntry(void** iter, Entry** prev_entry,
- const net::CompletionCallback& callback);
- void EndEnumeration(void* iterator);
+ void EndEnumeration(scoped_ptr<Rankings::Iterator> iterator);
void OnExternalCacheHit(const std::string& key);
void CloseEntryImpl(EntryImpl* entry);
void DoomEntryImpl(EntryImpl* entry);
// Blocks until all operations are cancelled or completed.
void WaitForPendingIO();
- scoped_refptr<base::MessageLoopProxy> background_thread() {
+ scoped_refptr<base::SingleThreadTaskRunner> background_thread() {
return background_thread_;
}
// Returns true if the current thread is the background thread.
bool BackgroundIsCurrentThread() {
- return background_thread_->BelongsToCurrentThread();
+ return background_thread_->RunsTasksOnCurrentThread();
}
base::WeakPtr<InFlightBackendIO> GetWeakPtr();
void PostOperation(BackendIO* operation);
BackendImpl* backend_;
- scoped_refptr<base::MessageLoopProxy> background_thread_;
+ scoped_refptr<base::SingleThreadTaskRunner> background_thread_;
base::WeakPtrFactory<InFlightBackendIO> ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(InFlightBackendIO);