| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/dns/serial_worker.h" | 5 #include "net/dns/serial_worker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 if (!base::WorkerPool::PostTask(FROM_HERE, base::Bind( | 29 if (!base::WorkerPool::PostTask(FROM_HERE, base::Bind( |
| 30 &SerialWorker::DoWorkJob, this), false)) { | 30 &SerialWorker::DoWorkJob, this), false)) { |
| 31 #if defined(OS_POSIX) | 31 #if defined(OS_POSIX) |
| 32 // See worker_pool_posix.cc. | 32 // See worker_pool_posix.cc. |
| 33 NOTREACHED() << "WorkerPool::PostTask is not expected to fail on posix"; | 33 NOTREACHED() << "WorkerPool::PostTask is not expected to fail on posix"; |
| 34 #else | 34 #else |
| 35 LOG(WARNING) << "Failed to WorkerPool::PostTask, will retry later"; | 35 LOG(WARNING) << "Failed to WorkerPool::PostTask, will retry later"; |
| 36 message_loop_->PostDelayedTask( | 36 message_loop_->PostDelayedTask( |
| 37 FROM_HERE, | 37 FROM_HERE, |
| 38 base::Bind(&SerialWorker::RetryWork, this), | 38 base::Bind(&SerialWorker::RetryWork, this), |
| 39 kWorkerPoolRetryDelayMs); | 39 base::TimeDelta::FromMilliseconds(kWorkerPoolRetryDelayMs)); |
| 40 state_ = WAITING; | 40 state_ = WAITING; |
| 41 return; | 41 return; |
| 42 #endif | 42 #endif |
| 43 } | 43 } |
| 44 state_ = WORKING; | 44 state_ = WORKING; |
| 45 return; | 45 return; |
| 46 case WORKING: | 46 case WORKING: |
| 47 // Remember to re-read after |DoRead| finishes. | 47 // Remember to re-read after |DoRead| finishes. |
| 48 state_ = PENDING; | 48 state_ = PENDING; |
| 49 return; | 49 return; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 state_ = IDLE; | 95 state_ = IDLE; |
| 96 WorkNow(); | 96 WorkNow(); |
| 97 return; | 97 return; |
| 98 default: | 98 default: |
| 99 NOTREACHED() << "Unexpected state " << state_; | 99 NOTREACHED() << "Unexpected state " << state_; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace net | 103 } // namespace net |
| 104 | 104 |
| OLD | NEW |