| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/test/base/testing_io_thread_state.h" | 5 #include "chrome/test/base/testing_io_thread_state.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
| 10 #include "chrome/browser/io_thread.h" | 12 #include "chrome/browser/io_thread.h" |
| 11 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
| 12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 13 | 15 |
| 14 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 17 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/network/network_handler.h" | 18 #include "chromeos/network/network_handler.h" |
| 17 #endif | 19 #endif |
| 18 | 20 |
| 19 using content::BrowserThread; | 21 using content::BrowserThread; |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 base::Closure ThreadSafeQuit(base::RunLoop* run_loop) { | 25 base::Closure ThreadSafeQuit(base::RunLoop* run_loop) { |
| 24 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 26 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 25 return run_loop->QuitClosure(); | 27 return run_loop->QuitClosure(); |
| 26 } else { | 28 } else { |
| 27 using base::Bind; | 29 using base::Bind; |
| 28 using base::IgnoreResult; | 30 using base::IgnoreResult; |
| 29 return Bind(IgnoreResult(&base::MessageLoopProxy::PostTask), | 31 return Bind(IgnoreResult(&base::SingleThreadTaskRunner::PostTask), |
| 30 base::MessageLoopProxy::current(), | 32 base::ThreadTaskRunnerHandle::Get(), FROM_HERE, |
| 31 FROM_HERE, | |
| 32 run_loop->QuitClosure()); | 33 run_loop->QuitClosure()); |
| 33 } | 34 } |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace | 37 } // namespace |
| 37 | 38 |
| 38 namespace chrome { | 39 namespace chrome { |
| 39 | 40 |
| 40 TestingIOThreadState::TestingIOThreadState() { | 41 TestingIOThreadState::TestingIOThreadState() { |
| 41 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 89 |
| 89 void TestingIOThreadState::Shutdown(const base::Closure& done) { | 90 void TestingIOThreadState::Shutdown(const base::Closure& done) { |
| 90 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 91 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 91 | 92 |
| 92 delete io_thread_state_->globals(); | 93 delete io_thread_state_->globals(); |
| 93 io_thread_state_->SetGlobalsForTesting(NULL); | 94 io_thread_state_->SetGlobalsForTesting(NULL); |
| 94 done.Run(); | 95 done.Run(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace chrome | 98 } // namespace chrome |
| OLD | NEW |