summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-09 08:35:25 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-09 08:35:25 +0000
commit243f86a720537c56e0b148e4277cfe319310cbd3 (patch)
tree16748220e894be5586cb11dfd8a1b365292f5ea5 /net
parent2de755222010708f16ea99af9e3dc2cfe41f96cf (diff)
downloadchromium_src-243f86a720537c56e0b148e4277cfe319310cbd3.zip
chromium_src-243f86a720537c56e0b148e4277cfe319310cbd3.tar.gz
chromium_src-243f86a720537c56e0b148e4277cfe319310cbd3.tar.bz2
rollback r526 to fix performance regression
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/url_request/url_request_file_job.cc11
-rw-r--r--net/url_request/url_request_file_job.h10
2 files changed, 11 insertions, 10 deletions
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 9f828d4..a738b3a 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -40,7 +40,7 @@
// attempts to read more from the file to fill its buffer. If reading from the
// file does not complete synchronously, then the URLRequestFileJob waits for a
// signal from the OS that the overlapped read has completed. It does so by
-// leveraging the ObjectWatcher API.
+// leveraging the MessageLoop::WatchObject API.
#include <process.h>
#include <windows.h>
@@ -57,7 +57,6 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_file_dir_job.h"
-// TODO(darin): The file job should not depend on WinInet!!
using net::WinInetUtil;
namespace {
@@ -166,7 +165,7 @@ void URLRequestFileJob::Start() {
void URLRequestFileJob::Kill() {
// If we are killed while waiting for an overlapped result...
if (is_waiting_) {
- watcher_.StopWatching();
+ MessageLoop::current()->WatchObject(overlapped_.hEvent, NULL);
is_waiting_ = false;
Release();
}
@@ -204,7 +203,7 @@ bool URLRequestFileJob::ReadRawData(char* dest, int dest_size,
DWORD err = GetLastError();
if (err == ERROR_IO_PENDING) {
// OK, wait for the object to become signaled
- watcher_.StartWatching(overlapped_.hEvent, this);
+ MessageLoop::current()->WatchObject(overlapped_.hEvent, this);
is_waiting_ = true;
SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
AddRef();
@@ -285,7 +284,9 @@ void URLRequestFileJob::OnObjectSignaled(HANDLE object) {
DCHECK(overlapped_.hEvent == object);
DCHECK(is_waiting_);
- // We'll resume watching this handle if need be when we do another IO.
+ // We'll resume watching this handle if need be when we do
+ // another IO.
+ MessageLoop::current()->WatchObject(object, NULL);
is_waiting_ = false;
DWORD bytes_read = 0;
diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h
index 076703f..349f258 100644
--- a/net/url_request/url_request_file_job.h
+++ b/net/url_request/url_request_file_job.h
@@ -32,7 +32,6 @@
#include "base/lock.h"
#include "base/message_loop.h"
-#include "base/object_watcher.h"
#include "base/thread.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
@@ -40,7 +39,7 @@
// A request job that handles reading file URLs
class URLRequestFileJob : public URLRequestJob,
- public base::ObjectWatcher::Delegate {
+ protected MessageLoop::Watcher {
public:
URLRequestFileJob(URLRequest* request);
virtual ~URLRequestFileJob();
@@ -63,10 +62,13 @@ class URLRequestFileJob : public URLRequestJob,
std::wstring file_path_;
private:
+ // The net util test wants to run our FileURLToFilePath function.
+ FRIEND_TEST(NetUtilTest, FileURLConversion);
+
void CloseHandles();
void StartAsync();
- // base::ObjectWatcher::Delegate implementation:
+ // MessageLoop::Watcher callback
virtual void OnObjectSignaled(HANDLE object);
// We use overlapped reads to ensure that reads from network file systems do
@@ -77,8 +79,6 @@ class URLRequestFileJob : public URLRequestJob,
bool is_directory_; // true when the file request is for a direcotry.
bool is_not_found_; // true when the file requested does not exist.
- base::ObjectWatcher watcher_;
-
// This lock ensure that the network_file_thread is not using the loop_ after
// is has been set to NULL in Kill().
Lock loop_lock_;