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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/TouchInputStrategy.java

Issue 2272483002: [Remoting Android] Remove Synchronizations on RenderData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback / Merge ToT Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.graphics.Matrix; 7 import android.graphics.Matrix;
8 import android.graphics.PointF; 8 import android.graphics.PointF;
9 import android.view.MotionEvent; 9 import android.view.MotionEvent;
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 private final RenderData mRenderData; 50 private final RenderData mRenderData;
51 private final InputEventSender mInjector; 51 private final InputEventSender mInjector;
52 52
53 public TouchInputStrategy(RenderData renderData, InputEventSender injector) { 53 public TouchInputStrategy(RenderData renderData, InputEventSender injector) {
54 Preconditions.notNull(injector); 54 Preconditions.notNull(injector);
55 mRenderData = renderData; 55 mRenderData = renderData;
56 mInjector = injector; 56 mInjector = injector;
57 mQueuedEvents = new LinkedList<MotionEvent>(); 57 mQueuedEvents = new LinkedList<MotionEvent>();
58 58
59 synchronized (mRenderData) { 59 mRenderData.drawCursor = false;
60 mRenderData.drawCursor = false;
61 }
62 } 60 }
63 61
64 @Override 62 @Override
65 public boolean onTap(int button) { 63 public boolean onTap(int button) {
66 if (mQueuedEvents.isEmpty() || mIgnoreTouchEvents) { 64 if (mQueuedEvents.isEmpty() || mIgnoreTouchEvents) {
67 return false; 65 return false;
68 } 66 }
69 67
70 switch (button) { 68 switch (button) {
71 case InputStub.BUTTON_LEFT: 69 case InputStub.BUTTON_LEFT:
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 while (!mQueuedEvents.isEmpty()) { 198 while (!mQueuedEvents.isEmpty()) {
201 mQueuedEvents.remove().recycle(); 199 mQueuedEvents.remove().recycle();
202 } 200 }
203 } 201 }
204 202
205 // NOTE: MotionEvents generated from this method should be recycled. 203 // NOTE: MotionEvents generated from this method should be recycled.
206 private MotionEvent transformToRemoteCoordinates(MotionEvent event) { 204 private MotionEvent transformToRemoteCoordinates(MotionEvent event) {
207 // Use a copy of the original event so the original event can be passed to other 205 // Use a copy of the original event so the original event can be passed to other
208 // detectors/handlers in an unmodified state. 206 // detectors/handlers in an unmodified state.
209 event = MotionEvent.obtain(event); 207 event = MotionEvent.obtain(event);
210 synchronized (mRenderData) { 208
211 // Transform the event coordinates so they represent the remote scre en coordinates 209 // Transform the event coordinates so they represent the remote screen c oordinates
212 // instead of the local touch display. 210 // instead of the local touch display.
213 Matrix inverted = new Matrix(); 211 Matrix inverted = new Matrix();
214 mRenderData.transform.invert(inverted); 212 mRenderData.transform.invert(inverted);
215 event.transform(inverted); 213 event.transform(inverted);
216 }
217 214
218 return event; 215 return event;
219 } 216 }
220 217
221 private void resetStateData() { 218 private void resetStateData() {
222 clearQueuedEvents(); 219 clearQueuedEvents();
223 mInRemoteGesture = false; 220 mInRemoteGesture = false;
224 mIgnoreTouchEvents = false; 221 mIgnoreTouchEvents = false;
225 } 222 }
226 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698