Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (monitor.isVSyncSignalAvailable()) { | |
| 55 nativeUpdateVSyncPeriod(mNativeWindowAndroid, | |
|
Sami
2014/09/30 16:04:14
Instead of adding a new JNI call, please merge thi
jmanko
2014/10/01 09:36:51
Acknowledged.
| |
| 56 mVSyncMonitor.getVSyncPeriodInMicros econds()); | |
| 57 } | |
| 54 nativeOnVSync(mNativeWindowAndroid, vsyncTimeMicros); | 58 nativeOnVSync(mNativeWindowAndroid, vsyncTimeMicros); |
| 55 } | 59 } |
| 56 } | 60 } |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 /** | 63 /** |
| 60 * @return true if onVSync handler is executing. | 64 * @return true if onVSync handler is executing. |
| 61 * @see org.chromium.ui.VSyncMonitor#isInsideVSync(). | 65 * @see org.chromium.ui.VSyncMonitor#isInsideVSync(). |
| 62 */ | 66 */ |
| 63 public boolean isInsideVSync() { | 67 public boolean isInsideVSync() { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 */ | 286 */ |
| 283 public long getNativePointer() { | 287 public long getNativePointer() { |
| 284 if (mNativeWindowAndroid == 0) { | 288 if (mNativeWindowAndroid == 0) { |
| 285 mNativeWindowAndroid = nativeInit(mVSyncMonitor.getVSyncPeriodInMicr oseconds()); | 289 mNativeWindowAndroid = nativeInit(mVSyncMonitor.getVSyncPeriodInMicr oseconds()); |
| 286 } | 290 } |
| 287 return mNativeWindowAndroid; | 291 return mNativeWindowAndroid; |
| 288 } | 292 } |
| 289 | 293 |
| 290 private native long nativeInit(long vsyncPeriod); | 294 private native long nativeInit(long vsyncPeriod); |
| 291 private native void nativeOnVSync(long nativeWindowAndroid, long vsyncTimeMi cros); | 295 private native void nativeOnVSync(long nativeWindowAndroid, long vsyncTimeMi cros); |
| 296 private native void nativeUpdateVSyncPeriod(long nativeWindowAndroid, long v syncPeriod); | |
| 292 private native void nativeDestroy(long nativeWindowAndroid); | 297 private native void nativeDestroy(long nativeWindowAndroid); |
| 293 | 298 |
| 294 } | 299 } |
| OLD | NEW |