Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Side by Side Diff: remoting/protocol/host_event_dispatcher.cc

Issue 1655433002: Remove done notifications from incoming message handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/host_event_dispatcher.h ('k') | remoting/protocol/host_video_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/host_event_dispatcher.h" 5 #include "remoting/protocol/host_event_dispatcher.h"
6 6
7 #include "base/callback_helpers.h"
8 #include "net/socket/stream_socket.h" 7 #include "net/socket/stream_socket.h"
9 #include "remoting/base/constants.h" 8 #include "remoting/base/constants.h"
10 #include "remoting/proto/event.pb.h" 9 #include "remoting/proto/event.pb.h"
11 #include "remoting/proto/internal.pb.h" 10 #include "remoting/proto/internal.pb.h"
12 #include "remoting/protocol/input_stub.h" 11 #include "remoting/protocol/input_stub.h"
13 12
14 namespace remoting { 13 namespace remoting {
15 namespace protocol { 14 namespace protocol {
16 15
17 HostEventDispatcher::HostEventDispatcher() 16 HostEventDispatcher::HostEventDispatcher()
18 : ChannelDispatcherBase(kEventChannelName), 17 : ChannelDispatcherBase(kEventChannelName),
19 input_stub_(nullptr), 18 input_stub_(nullptr),
20 parser_(base::Bind(&HostEventDispatcher::OnMessageReceived, 19 parser_(base::Bind(&HostEventDispatcher::OnMessageReceived,
21 base::Unretained(this)), 20 base::Unretained(this)),
22 reader()) {} 21 reader()) {}
23 22
24 HostEventDispatcher::~HostEventDispatcher() {} 23 HostEventDispatcher::~HostEventDispatcher() {}
25 24
26 void HostEventDispatcher::OnMessageReceived(scoped_ptr<EventMessage> message, 25 void HostEventDispatcher::OnMessageReceived(scoped_ptr<EventMessage> message) {
27 const base::Closure& done_task) {
28 DCHECK(input_stub_); 26 DCHECK(input_stub_);
29 27
30 base::ScopedClosureRunner done_runner(done_task);
31
32 if (!on_input_event_callback_.is_null()) 28 if (!on_input_event_callback_.is_null())
33 on_input_event_callback_.Run(message->timestamp()); 29 on_input_event_callback_.Run(message->timestamp());
34 30
35 if (message->has_key_event()) { 31 if (message->has_key_event()) {
36 const KeyEvent& event = message->key_event(); 32 const KeyEvent& event = message->key_event();
37 if (event.has_usb_keycode() && event.has_pressed()) { 33 if (event.has_usb_keycode() && event.has_pressed()) {
38 input_stub_->InjectKeyEvent(event); 34 input_stub_->InjectKeyEvent(event);
39 } else { 35 } else {
40 LOG(WARNING) << "Received invalid key event."; 36 LOG(WARNING) << "Received invalid key event.";
41 } 37 }
42 } else if (message->has_text_event()) { 38 } else if (message->has_text_event()) {
43 const TextEvent& event = message->text_event(); 39 const TextEvent& event = message->text_event();
44 if (event.has_text()) { 40 if (event.has_text()) {
45 input_stub_->InjectTextEvent(event); 41 input_stub_->InjectTextEvent(event);
46 } else { 42 } else {
47 LOG(WARNING) << "Received invalid text event."; 43 LOG(WARNING) << "Received invalid text event.";
48 } 44 }
49 } else if (message->has_mouse_event()) { 45 } else if (message->has_mouse_event()) {
50 input_stub_->InjectMouseEvent(message->mouse_event()); 46 input_stub_->InjectMouseEvent(message->mouse_event());
51 } else if (message->has_touch_event()) { 47 } else if (message->has_touch_event()) {
52 input_stub_->InjectTouchEvent(message->touch_event()); 48 input_stub_->InjectTouchEvent(message->touch_event());
53 } else { 49 } else {
54 LOG(WARNING) << "Unknown event message received."; 50 LOG(WARNING) << "Unknown event message received.";
55 } 51 }
56 } 52 }
57 53
58 } // namespace protocol 54 } // namespace protocol
59 } // namespace remoting 55 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/host_event_dispatcher.h ('k') | remoting/protocol/host_video_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698