PageLanguageDetectionTest has the failure rate of 5 - 6% on XP/Vista. Mark it
[chromium-blink-merge.git] / base / worker_pool_win.cc
blob3f383b9c0714db2f1f3132c109906884453aea8f
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/worker_pool.h"
7 #include "base/logging.h"
8 #include "base/task.h"
10 namespace {
12 DWORD CALLBACK WorkItemCallback(void* param) {
13 Task* task = static_cast<Task*>(param);
14 task->Run();
15 delete task;
16 return 0;
19 } // namespace
21 bool WorkerPool::PostTask(const tracked_objects::Location& from_here,
22 Task* task, bool task_is_slow) {
23 task->SetBirthPlace(from_here);
25 ULONG flags = 0;
26 if (task_is_slow)
27 flags |= WT_EXECUTELONGFUNCTION;
29 if (!QueueUserWorkItem(WorkItemCallback, task, flags)) {
30 DLOG(ERROR) << "QueueUserWorkItem failed: " << GetLastError();
31 delete task;
32 return false;
35 return true;