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/protocol/clipboard_thread_proxy.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/message_loop.h" | |
9 #include "remoting/proto/event.pb.h" | |
10 | |
11 namespace remoting { | |
12 namespace protocol { | |
13 | |
14 ClipboardThreadProxy::ClipboardThreadProxy( | |
15 const base::WeakPtr<ClipboardStub>& clipboard_stub, | |
16 scoped_refptr<base::MessageLoopProxy> clipboard_stub_message_loop) | |
17 : clipboard_stub_(clipboard_stub), | |
18 clipboard_stub_message_loop_(clipboard_stub_message_loop) { | |
19 } | |
20 | |
21 void ClipboardThreadProxy::InjectClipboardEvent(const ClipboardEvent& event) { | |
22 if (!clipboard_stub_message_loop_->BelongsToCurrentThread()) { | |
Wez
2012/05/30 23:58:02
Since you're no longer trampolining the same metho
simonmorris
2012/05/31 00:21:18
Done.
| |
23 clipboard_stub_message_loop_->PostTask(FROM_HERE, base::Bind( | |
24 &ClipboardThreadProxy::InjectClipboardEventStatic, | |
25 clipboard_stub_, | |
26 event)); | |
27 return; | |
28 } | |
29 | |
30 InjectClipboardEventStatic(clipboard_stub_, event); | |
31 } | |
32 | |
33 void ClipboardThreadProxy::InjectClipboardEventStatic( | |
34 const base::WeakPtr<ClipboardStub>& clipboard_stub, | |
35 const ClipboardEvent& event) { | |
36 if (clipboard_stub) { | |
Wez
2012/05/30 23:58:02
nit: clipboard_stub.get(), for clarity?
simonmorris
2012/05/31 00:21:18
Done.
| |
37 clipboard_stub->InjectClipboardEvent(event); | |
38 } | |
39 } | |
40 | |
41 ClipboardThreadProxy::~ClipboardThreadProxy() { | |
Wez
2012/05/30 23:58:02
nit: Move this above ctor to match the header.
simonmorris
2012/05/31 00:21:18
Done.
| |
42 } | |
43 | |
44 } // namespace protocol | |
45 } // namespace remoting | |
OLD | NEW |