OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/host_window.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" |
| 10 #include "base/logging.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/utf_string_conversions.h" |
| 13 |
| 14 namespace remoting { |
| 15 |
| 16 HostWindow::~HostWindow() { |
| 17 core_->Stop(); |
| 18 } |
| 19 |
| 20 HostWindow::Core::Core( |
| 21 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 22 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 23 const UiStrings& ui_strings) |
| 24 : caller_task_runner_(caller_task_runner), |
| 25 ui_task_runner_(ui_task_runner), |
| 26 ui_strings_(ui_strings) { |
| 27 } |
| 28 |
| 29 void HostWindow::Core::Start() { |
| 30 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 31 |
| 32 ui_task_runner_->PostTask(FROM_HERE, |
| 33 base::Bind(&Core::StartOnUiThread, this)); |
| 34 } |
| 35 |
| 36 void HostWindow::Core::Stop() { |
| 37 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 38 |
| 39 ui_task_runner_->PostTask(FROM_HERE, base::Bind(&Core::StopOnUiThread, this)); |
| 40 } |
| 41 |
| 42 HostWindow::Core::~Core() { |
| 43 } |
| 44 |
| 45 HostWindow::HostWindow(scoped_refptr<Core> core) |
| 46 : core_(core) { |
| 47 core_->Start(); |
| 48 } |
| 49 |
| 50 } // namespace remoting |
OLD | NEW |