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 "remoting/protocol/protocol_mock_objects.h" | 5 #include "remoting/protocol/protocol_mock_objects.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "remoting/protocol/video_stream.h" | 9 #include "remoting/protocol/video_stream.h" |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { | 53 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { |
54 } | 54 } |
55 | 55 |
56 scoped_ptr<base::ListValue> MockPairingRegistryDelegate::LoadAll() { | 56 scoped_ptr<base::ListValue> MockPairingRegistryDelegate::LoadAll() { |
57 scoped_ptr<base::ListValue> result(new base::ListValue()); | 57 scoped_ptr<base::ListValue> result(new base::ListValue()); |
58 for (Pairings::const_iterator i = pairings_.begin(); i != pairings_.end(); | 58 for (Pairings::const_iterator i = pairings_.begin(); i != pairings_.end(); |
59 ++i) { | 59 ++i) { |
60 result->Append(i->second.ToValue().release()); | 60 result->Append(i->second.ToValue().release()); |
61 } | 61 } |
62 return result.Pass(); | 62 return result; |
63 } | 63 } |
64 | 64 |
65 bool MockPairingRegistryDelegate::DeleteAll() { | 65 bool MockPairingRegistryDelegate::DeleteAll() { |
66 pairings_.clear(); | 66 pairings_.clear(); |
67 return true; | 67 return true; |
68 } | 68 } |
69 | 69 |
70 protocol::PairingRegistry::Pairing MockPairingRegistryDelegate::Load( | 70 protocol::PairingRegistry::Pairing MockPairingRegistryDelegate::Load( |
71 const std::string& client_id) { | 71 const std::string& client_id) { |
72 Pairings::const_iterator i = pairings_.find(client_id); | 72 Pairings::const_iterator i = pairings_.find(client_id); |
(...skipping 10 matching lines...) Expand all Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 bool MockPairingRegistryDelegate::Delete(const std::string& client_id) { | 86 bool MockPairingRegistryDelegate::Delete(const std::string& client_id) { |
87 pairings_.erase(client_id); | 87 pairings_.erase(client_id); |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 SynchronousPairingRegistry::SynchronousPairingRegistry( | 91 SynchronousPairingRegistry::SynchronousPairingRegistry( |
92 scoped_ptr<Delegate> delegate) | 92 scoped_ptr<Delegate> delegate) |
93 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), delegate.Pass()) { | 93 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), |
94 } | 94 std::move(delegate)) {} |
95 | 95 SynchronousPairingRegistry::~SynchronousPairingRegistry() {} |
96 SynchronousPairingRegistry::~SynchronousPairingRegistry() { | |
97 } | |
98 | 96 |
99 void SynchronousPairingRegistry::PostTask( | 97 void SynchronousPairingRegistry::PostTask( |
100 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 98 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
101 const tracked_objects::Location& from_here, | 99 const tracked_objects::Location& from_here, |
102 const base::Closure& task) { | 100 const base::Closure& task) { |
103 DCHECK(task_runner->BelongsToCurrentThread()); | 101 DCHECK(task_runner->BelongsToCurrentThread()); |
104 task.Run(); | 102 task.Run(); |
105 } | 103 } |
106 | 104 |
107 } // namespace protocol | 105 } // namespace protocol |
108 } // namespace remoting | 106 } // namespace remoting |
OLD | NEW |