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

Unified Diff: mojo/services/native_viewport/native_viewport_service.cc

Issue 218763002: Change AckEvent into request / response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix early return Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/native_viewport/native_viewport.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_service.cc
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
index fe8729dc7cad1c230f99e51c9878bc6a0b91edbe..00801b62e0ec4713f324aa363fff9c064c0ae495 100644
--- a/mojo/services/native_viewport/native_viewport_service.cc
+++ b/mojo/services/native_viewport/native_viewport_service.cc
@@ -33,8 +33,7 @@ class NativeViewportImpl
public:
NativeViewportImpl()
: widget_(gfx::kNullAcceleratedWidget),
- waiting_for_event_ack_(false),
- pending_event_timestamp_(0) {}
+ waiting_for_event_ack_(false) {}
virtual ~NativeViewportImpl() {}
virtual void Create(const Rect& bounds) OVERRIDE {
@@ -82,8 +81,7 @@ class NativeViewportImpl
CreateCommandBufferIfNeeded();
}
- virtual void AckEvent(const Event& event) OVERRIDE {
- DCHECK_EQ(event.time_stamp(), pending_event_timestamp_);
+ void AckEvent() {
waiting_for_event_ack_ = false;
}
@@ -118,13 +116,12 @@ class NativeViewportImpl
if (waiting_for_event_ack_ && IsRateLimitedEventType(ui_event))
return false;
- pending_event_timestamp_ = ui_event->time_stamp().ToInternalValue();
AllocationScope scope;
Event::Builder event;
event.set_action(ui_event->type());
event.set_flags(ui_event->flags());
- event.set_time_stamp(pending_event_timestamp_);
+ event.set_time_stamp(ui_event->time_stamp().ToInternalValue());
if (ui_event->IsMouseEvent() || ui_event->IsTouchEvent()) {
ui::LocatedEvent* located_event =
@@ -148,7 +145,9 @@ class NativeViewportImpl
event.set_key_data(key_data.Finish());
}
- client()->OnEvent(event.Finish());
+ client()->OnEvent(event.Finish(),
+ base::Bind(&NativeViewportImpl::AckEvent,
+ base::Unretained(this)));
waiting_for_event_ack_ = true;
return false;
}
@@ -177,7 +176,6 @@ class NativeViewportImpl
ScopedCommandBufferClientHandle command_buffer_handle_;
scoped_ptr<CommandBufferImpl> command_buffer_;
bool waiting_for_event_ack_;
- int64 pending_event_timestamp_;
};
} // namespace services
« no previous file with comments | « mojo/services/native_viewport/native_viewport.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698