summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-30 18:08:36 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-30 18:08:36 +0000
commitac9ba8fe1d2f2397de3d7c4cebfb3c659d226fd3 (patch)
tree7118143b15fb701d5d91de270a1af7ea431eaa8a /net
parentb8eeb3eeba2418d9a1a7bb8429ddd5ec592298c1 (diff)
downloadchromium_src-ac9ba8fe1d2f2397de3d7c4cebfb3c659d226fd3.zip
chromium_src-ac9ba8fe1d2f2397de3d7c4cebfb3c659d226fd3.tar.gz
chromium_src-ac9ba8fe1d2f2397de3d7c4cebfb3c659d226fd3.tar.bz2
Move some misc thread-related stuff from base to base/thread and into the base
namespace. This does not move the "hard" thread stuff (thread.h). TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/6079009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/cert_verifier.cc8
-rw-r--r--net/base/dnsrr_resolver.cc8
-rw-r--r--net/base/file_stream_posix.cc22
-rw-r--r--net/base/host_resolver_impl.cc6
-rw-r--r--net/base/keygen_handler_unittest.cc10
-rw-r--r--net/base/test_completion_callback_unittest.cc8
-rw-r--r--net/disk_cache/backend_impl.cc4
-rw-r--r--net/disk_cache/file_posix.cc6
-rw-r--r--net/proxy/polling_proxy_config_service.cc8
-rw-r--r--net/tools/flip_server/flip_in_mem_edsm_server.cc2
-rw-r--r--net/url_request/url_request_file_job.cc7
11 files changed, 43 insertions, 46 deletions
diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc
index 4b3d904..3d22dec 100644
--- a/net/base/cert_verifier.cc
+++ b/net/base/cert_verifier.cc
@@ -8,7 +8,7 @@
#include "base/lock.h"
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/base/net_errors.h"
#include "net/base/x509_certificate.h"
@@ -136,9 +136,9 @@ class CertVerifierWorker {
bool Start() {
DCHECK_EQ(MessageLoop::current(), origin_loop_);
- return WorkerPool::PostTask(
- FROM_HERE, NewRunnableMethod(this, &CertVerifierWorker::Run),
- true /* task is slow */);
+ return base::WorkerPool::PostTask(
+ FROM_HERE, NewRunnableMethod(this, &CertVerifierWorker::Run),
+ true /* task is slow */);
}
// Cancel is called from the origin loop when the CertVerifier is getting
diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc
index 30031f3..393c213 100644
--- a/net/base/dnsrr_resolver.cc
+++ b/net/base/dnsrr_resolver.cc
@@ -15,7 +15,7 @@
#include "base/stl_util-inl.h"
#include "base/string_piece.h"
#include "base/task.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/base/dns_reload_timer.h"
#include "net/base/dns_util.h"
#include "net/base/net_errors.h"
@@ -139,9 +139,9 @@ class RRResolverWorker {
bool Start() {
DCHECK_EQ(MessageLoop::current(), origin_loop_);
- return WorkerPool::PostTask(
- FROM_HERE, NewRunnableMethod(this, &RRResolverWorker::Run),
- true /* task is slow */);
+ return base::WorkerPool::PostTask(
+ FROM_HERE, NewRunnableMethod(this, &RRResolverWorker::Run),
+ true /* task is slow */);
}
// Cancel is called from the origin loop when the DnsRRResolver is getting
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 1e20efe..887d9c1 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -21,8 +21,8 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/string_util.h"
+#include "base/threading/worker_pool.h"
#include "base/waitable_event.h"
-#include "base/worker_pool.h"
#include "net/base/net_errors.h"
// We cast back and forth, so make sure it's the size we're expecting.
@@ -250,11 +250,11 @@ void FileStream::AsyncContext::InitiateAsyncRead(
DCHECK(!callback_);
callback_ = callback;
- WorkerPool::PostTask(FROM_HERE,
- new BackgroundReadTask(
- file, buf, buf_len,
- &background_io_completed_callback_),
- true /* task_is_slow */);
+ base::WorkerPool::PostTask(FROM_HERE,
+ new BackgroundReadTask(
+ file, buf, buf_len,
+ &background_io_completed_callback_),
+ true /* task_is_slow */);
}
void FileStream::AsyncContext::InitiateAsyncWrite(
@@ -263,11 +263,11 @@ void FileStream::AsyncContext::InitiateAsyncWrite(
DCHECK(!callback_);
callback_ = callback;
- WorkerPool::PostTask(FROM_HERE,
- new BackgroundWriteTask(
- file, buf, buf_len,
- &background_io_completed_callback_),
- true /* task_is_slow */);
+ base::WorkerPool::PostTask(FROM_HERE,
+ new BackgroundWriteTask(
+ file, buf, buf_len,
+ &background_io_completed_callback_),
+ true /* task_is_slow */);
}
void FileStream::AsyncContext::OnBackgroundIOCompleted(int result) {
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index b53ec6d..6e4637c 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -24,10 +24,10 @@
#include "base/metrics/histogram.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "base/threading/worker_pool.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "base/worker_pool.h"
#include "net/base/address_list.h"
#include "net/base/address_list_net_log_param.h"
#include "net/base/host_port_pair.h"
@@ -382,7 +382,7 @@ class HostResolverImpl::Job
start_time_ = base::TimeTicks::Now();
// Dispatch the job to a worker thread.
- if (!WorkerPool::PostTask(FROM_HERE,
+ if (!base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(this, &Job::DoLookup), true)) {
NOTREACHED();
@@ -650,7 +650,7 @@ class HostResolverImpl::IPv6ProbeJob
return;
DCHECK(IsOnOriginThread());
const bool kIsSlow = true;
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE, NewRunnableMethod(this, &IPv6ProbeJob::DoProbe), kIsSlow);
}
diff --git a/net/base/keygen_handler_unittest.cc b/net/base/keygen_handler_unittest.cc
index f4251f2..10ccc95 100644
--- a/net/base/keygen_handler_unittest.cc
+++ b/net/base/keygen_handler_unittest.cc
@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "base/nss_util.h"
#include "base/task.h"
+#include "base/threading/worker_pool.h"
#include "base/thread_restrictions.h"
#include "base/waitable_event.h"
-#include "base/worker_pool.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_NSS)
@@ -124,10 +124,10 @@ TEST_F(KeygenHandlerTest, ConcurrencyTest) {
std::string results[NUM_HANDLERS];
for (int i = 0; i < NUM_HANDLERS; i++) {
events[i] = new base::WaitableEvent(false, false);
- WorkerPool::PostTask(FROM_HERE,
- new ConcurrencyTestTask(events[i], "some challenge",
- &results[i]),
- true);
+ base::WorkerPool::PostTask(
+ FROM_HERE,
+ new ConcurrencyTestTask(events[i], "some challenge", &results[i]),
+ true);
}
for (int i = 0; i < NUM_HANDLERS; i++) {
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index c19aae0..a0ae9bf 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -1,13 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Illustrates how to use worker threads that issue completion callbacks
-#include "testing/gtest/include/gtest/gtest.h"
+#include "base/threading/worker_pool.h"
#include "net/base/completion_callback.h"
#include "net/base/test_completion_callback.h"
-#include "base/worker_pool.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
typedef PlatformTest TestCompletionCallbackTest;
@@ -102,7 +102,7 @@ bool ExampleEmployer::DoSomething(CompletionCallback* callback) {
request_ = new ExampleWorker(this, callback);
// Dispatch to worker thread...
- if (!WorkerPool::PostTask(FROM_HERE,
+ if (!base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(request_.get(), &ExampleWorker::DoWork), true)) {
NOTREACHED();
request_ = NULL;
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 96f8723..4eab2675 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -13,10 +13,10 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_info.h"
+#include "base/threading/worker_pool.h"
#include "base/thread_restrictions.h"
#include "base/time.h"
#include "base/timer.h"
-#include "base/worker_pool.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/entry_impl.h"
@@ -142,7 +142,7 @@ bool DelayedCacheCleanup(const FilePath& full_path) {
return false;
}
- WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
+ base::WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
return true;
}
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index 1870c0b..01dafd3 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -7,7 +7,7 @@
#include <fcntl.h>
#include "base/logging.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/in_flight_io.h"
@@ -113,7 +113,7 @@ void FileInFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len,
new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
file->AddRef(); // Balanced on OnOperationComplete()
- WorkerPool::PostTask(FROM_HERE,
+ base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(operation.get(), &FileBackgroundIO::Read), true);
OnOperationPosted(operation);
}
@@ -125,7 +125,7 @@ void FileInFlightIO::PostWrite(disk_cache::File* file, const void* buf,
new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
file->AddRef(); // Balanced on OnOperationComplete()
- WorkerPool::PostTask(FROM_HERE,
+ base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(operation.get(), &FileBackgroundIO::Write), true);
OnOperationPosted(operation);
}
diff --git a/net/proxy/polling_proxy_config_service.cc b/net/proxy/polling_proxy_config_service.cc
index 2db9792..98a164d 100644
--- a/net/proxy/polling_proxy_config_service.cc
+++ b/net/proxy/polling_proxy_config_service.cc
@@ -8,7 +8,7 @@
#include "base/message_loop_proxy.h"
#include "base/observer_list.h"
#include "base/scoped_ptr.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/proxy/proxy_config.h"
namespace net {
@@ -88,10 +88,10 @@ class PollingProxyConfigService::Core
last_poll_time_ = base::TimeTicks::Now();
poll_task_outstanding_ = true;
poll_task_queued_ = false;
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE,
- NewRunnableMethod(
- this, &Core::PollOnWorkerThread, get_config_func_), true);
+ NewRunnableMethod(this, &Core::PollOnWorkerThread, get_config_func_),
+ true);
}
private:
diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc
index 1969e0c..a378e72 100644
--- a/net/tools/flip_server/flip_in_mem_edsm_server.cc
+++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc
@@ -19,7 +19,7 @@
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/timer.h"
#include "base/lock.h"
#include "net/spdy/spdy_frame_builder.h"
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 230ee06..d7ebe0a 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -23,6 +23,7 @@
#include "base/message_loop.h"
#include "base/platform_file.h"
#include "base/string_util.h"
+#include "base/threading/worker_pool.h"
#include "base/thread_restrictions.h"
#include "build/build_config.h"
#include "googleurl/src/gurl.h"
@@ -36,10 +37,6 @@
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_dir_job.h"
-#if defined(OS_WIN)
-#include "base/worker_pool.h"
-#endif
-
namespace net {
#if defined(OS_WIN)
@@ -136,7 +133,7 @@ void URLRequestFileJob::Start() {
if (!file_path_.value().compare(0, 2, L"\\\\")) {
DCHECK(!async_resolver_);
async_resolver_ = new AsyncResolver(this);
- WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
+ base::WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
async_resolver_.get(), &AsyncResolver::Resolve, file_path_), true);
return;
}