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

Side by Side Diff: ui/android/java/src/org/chromium/ui/base/WindowAndroid.java

Issue 611313003: Use estimated vsync period on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused constant Created 6 years, 2 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 | « ui/android/java/src/org/chromium/ui/VSyncMonitor.java ('k') | ui/base/android/window_android.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 package org.chromium.ui.base; 5 package org.chromium.ui.base;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.app.PendingIntent; 9 import android.app.PendingIntent;
10 import android.content.ContentResolver; 10 import android.content.ContentResolver;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 // Ideally, this would be a SparseArray<String>, but there's no easy way to store a 45 // Ideally, this would be a SparseArray<String>, but there's no easy way to store a
46 // SparseArray<String> in a bundle during saveInstanceState(). So we use a H ashMap and suppress 46 // SparseArray<String> in a bundle during saveInstanceState(). So we use a H ashMap and suppress
47 // the Android lint warning "UseSparseArrays". 47 // the Android lint warning "UseSparseArrays".
48 protected HashMap<Integer, String> mIntentErrors; 48 protected HashMap<Integer, String> mIntentErrors;
49 49
50 private final VSyncMonitor.Listener mVSyncListener = new VSyncMonitor.Listen er() { 50 private final VSyncMonitor.Listener mVSyncListener = new VSyncMonitor.Listen er() {
51 @Override 51 @Override
52 public void onVSync(VSyncMonitor monitor, long vsyncTimeMicros) { 52 public void onVSync(VSyncMonitor monitor, long vsyncTimeMicros) {
53 if (mNativeWindowAndroid != 0) { 53 if (mNativeWindowAndroid != 0) {
54 nativeOnVSync(mNativeWindowAndroid, vsyncTimeMicros); 54 nativeOnVSync(mNativeWindowAndroid,
55 vsyncTimeMicros,
56 mVSyncMonitor.getVSyncPeriodInMicroseconds());
55 } 57 }
56 } 58 }
57 }; 59 };
58 60
59 /** 61 /**
60 * @return true if onVSync handler is executing. 62 * @return true if onVSync handler is executing.
61 * @see org.chromium.ui.VSyncMonitor#isInsideVSync(). 63 * @see org.chromium.ui.VSyncMonitor#isInsideVSync().
62 */ 64 */
63 public boolean isInsideVSync() { 65 public boolean isInsideVSync() {
64 return mVSyncMonitor.isInsideVSync(); 66 return mVSyncMonitor.isInsideVSync();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 277 }
276 } 278 }
277 279
278 /** 280 /**
279 * Returns a pointer to the c++ AndroidWindow object and calls the initializ er if 281 * Returns a pointer to the c++ AndroidWindow object and calls the initializ er if
280 * the object has not been previously initialized. 282 * the object has not been previously initialized.
281 * @return A pointer to the c++ AndroidWindow. 283 * @return A pointer to the c++ AndroidWindow.
282 */ 284 */
283 public long getNativePointer() { 285 public long getNativePointer() {
284 if (mNativeWindowAndroid == 0) { 286 if (mNativeWindowAndroid == 0) {
285 mNativeWindowAndroid = nativeInit(mVSyncMonitor.getVSyncPeriodInMicr oseconds()); 287 mNativeWindowAndroid = nativeInit();
286 } 288 }
287 return mNativeWindowAndroid; 289 return mNativeWindowAndroid;
288 } 290 }
289 291
290 private native long nativeInit(long vsyncPeriod); 292 private native long nativeInit();
291 private native void nativeOnVSync(long nativeWindowAndroid, long vsyncTimeMi cros); 293 private native void nativeOnVSync(long nativeWindowAndroid,
294 long vsyncTimeMicros,
295 long vsyncPeriodMicros);
292 private native void nativeDestroy(long nativeWindowAndroid); 296 private native void nativeDestroy(long nativeWindowAndroid);
293 297
294 } 298 }
OLDNEW
« no previous file with comments | « ui/android/java/src/org/chromium/ui/VSyncMonitor.java ('k') | ui/base/android/window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698