diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-06 20:35:45 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-06 20:35:45 +0000 |
commit | 5846da03b8e2673d6be22f317a4eba89db9a03ed (patch) | |
tree | e732d84d13bd29d608f184f9d58671c4feed82e0 /base | |
parent | ea8395df79a1585f765946a002676cf2bf1c65c5 (diff) | |
download | chromium_src-5846da03b8e2673d6be22f317a4eba89db9a03ed.zip chromium_src-5846da03b8e2673d6be22f317a4eba89db9a03ed.tar.gz chromium_src-5846da03b8e2673d6be22f317a4eba89db9a03ed.tar.bz2 |
In preparation for making changes to worker_pool_linux.cc.
Review URL: http://codereview.chromium.org/39081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base.gyp | 4 | ||||
-rw-r--r-- | base/base.scons | 6 | ||||
-rw-r--r-- | base/build/base.vcproj | 2 | ||||
-rw-r--r-- | base/worker_pool_linux.cc (renamed from base/worker_pool.cc) | 35 | ||||
-rw-r--r-- | base/worker_pool_win.cc | 35 |
5 files changed, 41 insertions, 41 deletions
diff --git a/base/base.gyp b/base/base.gyp index bacdb10..17ca9ce 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -285,9 +285,10 @@ 'wmi_util.h', 'word_iterator.cc', 'word_iterator.h', - 'worker_pool.cc', 'worker_pool.h', + 'worker_pool_linux.cc', 'worker_pool_mac.mm', + 'worker_pool_win.cc', ], 'include_dirs': [ '..', @@ -327,7 +328,6 @@ [ 'OS == "mac"', { 'sources/': [ ['exclude', '_(linux|win)\\.cc$'] ], 'sources!': [ - 'worker_pool.cc', ], 'link_settings': { 'libraries': [ diff --git a/base/base.scons b/base/base.scons index 8616c88..dcc524d 100644 --- a/base/base.scons +++ b/base/base.scons @@ -266,8 +266,8 @@ input_files = ChromeFileList([ 'wmi_util.h', 'word_iterator.cc', 'word_iterator.h', - 'worker_pool.cc', 'worker_pool.h', + 'worker_pool_win.cc', ]) if env.Bit('posix'): @@ -339,7 +339,7 @@ if not env.Bit('windows'): 'waitable_event_watcher_win.cc', 'win_util.cc', 'wmi_util.cc', - 'worker_pool.cc', + 'worker_pool_win.cc', ) if env.Bit('posix'): @@ -398,7 +398,7 @@ if env.Bit('linux'): 'process_util_linux.cc', 'sys_string_conversions_linux.cc', 'test_file_util_linux.cc', - 'worker_pool.cc', + 'worker_pool_linux.cc', ]) env.ChromeLibrary('base', input_files) diff --git a/base/build/base.vcproj b/base/build/base.vcproj index b9dacfc..b31949f 100644 --- a/base/build/base.vcproj +++ b/base/build/base.vcproj @@ -1030,7 +1030,7 @@ > </File> <File - RelativePath="..\worker_pool.cc" + RelativePath="..\worker_pool_win.cc" > </File> <File diff --git a/base/worker_pool.cc b/base/worker_pool_linux.cc index ae513e1..fce8861 100644 --- a/base/worker_pool.cc +++ b/base/worker_pool_linux.cc @@ -6,39 +6,6 @@ #include "base/task.h" -// TODO(dsh): Split this file into worker_pool_win.cc and worker_pool_posix.cc. -#if defined(OS_WIN) - -namespace { - -DWORD CALLBACK WorkItemCallback(void* param) { - Task* task = static_cast<Task*>(param); - task->Run(); - delete task; - return 0; -} - -} // namespace - -bool WorkerPool::PostTask(const tracked_objects::Location& from_here, - Task* task, bool task_is_slow) { - task->SetBirthPlace(from_here); - - ULONG flags = 0; - if (task_is_slow) - flags |= WT_EXECUTELONGFUNCTION; - - if (!QueueUserWorkItem(WorkItemCallback, task, flags)) { - DLOG(ERROR) << "QueueUserWorkItem failed: " << GetLastError(); - delete task; - return false; - } - - return true; -} - -#elif defined(OS_LINUX) - namespace { void* PThreadCallback(void* param) { @@ -73,5 +40,3 @@ bool WorkerPool::PostTask(const tracked_objects::Location& from_here, return true; } - -#endif // OS_LINUX diff --git a/base/worker_pool_win.cc b/base/worker_pool_win.cc new file mode 100644 index 0000000..4bf0947 --- /dev/null +++ b/base/worker_pool_win.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2006-2008 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. + +#include "base/worker_pool.h" + +#include "base/task.h" + +namespace { + +DWORD CALLBACK WorkItemCallback(void* param) { + Task* task = static_cast<Task*>(param); + task->Run(); + delete task; + return 0; +} + +} // namespace + +bool WorkerPool::PostTask(const tracked_objects::Location& from_here, + Task* task, bool task_is_slow) { + task->SetBirthPlace(from_here); + + ULONG flags = 0; + if (task_is_slow) + flags |= WT_EXECUTELONGFUNCTION; + + if (!QueueUserWorkItem(WorkItemCallback, task, flags)) { + DLOG(ERROR) << "QueueUserWorkItem failed: " << GetLastError(); + delete task; + return false; + } + + return true; +} |