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

Unified Diff: net/disk_cache/cache_util_win.cc

Issue 8156: Switch MessagePumpForIO to use completion ports on Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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/base/file_stream_win.cc ('k') | net/disk_cache/disk_cache_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/cache_util_win.cc
===================================================================
--- net/disk_cache/cache_util_win.cc (revision 4870)
+++ net/disk_cache/cache_util_win.cc (working copy)
@@ -7,6 +7,7 @@
#include <windows.h>
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/scoped_handle.h"
#include "base/file_util.h"
@@ -38,6 +39,9 @@
namespace disk_cache {
+// Implemented in file_win.cc.
+MessageLoopForIO::IOHandler* GetFileIOHandler();
+
bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) {
// I don't want to use the shell version of move because if something goes
// wrong, that version will attempt to move file by file and fail at the end.
@@ -63,12 +67,8 @@
void WaitForPendingIO(int* num_pending_io) {
while (*num_pending_io) {
// Asynchronous IO operations may be in flight and the completion may end
- // up calling us back so let's wait for them (we need an alertable wait).
- // The idea is to let other threads do usefull work and at the same time
- // allow more than one IO to finish... 20 mS later, we process all queued
- // APCs and see if we have to repeat the wait.
- Sleep(20);
- SleepEx(0, TRUE);
+ // up calling us back so let's wait for them.
+ MessageLoopForIO::current()->WaitForIOCompletion(100, GetFileIOHandler());
}
}
« no previous file with comments | « net/base/file_stream_win.cc ('k') | net/disk_cache/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698