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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java

Issue 949613002: [Android] Add animation frame time histogram class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « base/time/time_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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.chrome.browser.appmenu; 5 package org.chromium.chrome.browser.appmenu;
6 6
7 import android.animation.Animator; 7 import android.animation.Animator;
8 import android.animation.Animator.AnimatorListener;
8 import android.animation.AnimatorSet; 9 import android.animation.AnimatorSet;
9 import android.content.Context; 10 import android.content.Context;
10 import android.content.res.Resources; 11 import android.content.res.Resources;
11 import android.graphics.Rect; 12 import android.graphics.Rect;
12 import android.graphics.drawable.Drawable; 13 import android.graphics.drawable.Drawable;
13 import android.view.KeyEvent; 14 import android.view.KeyEvent;
14 import android.view.LayoutInflater; 15 import android.view.LayoutInflater;
15 import android.view.Menu; 16 import android.view.Menu;
16 import android.view.MenuItem; 17 import android.view.MenuItem;
17 import android.view.Surface; 18 import android.view.Surface;
18 import android.view.View; 19 import android.view.View;
19 import android.view.View.OnKeyListener; 20 import android.view.View.OnKeyListener;
20 import android.view.ViewGroup; 21 import android.view.ViewGroup;
21 import android.widget.AdapterView; 22 import android.widget.AdapterView;
22 import android.widget.AdapterView.OnItemClickListener; 23 import android.widget.AdapterView.OnItemClickListener;
23 import android.widget.ImageButton; 24 import android.widget.ImageButton;
24 import android.widget.ListPopupWindow; 25 import android.widget.ListPopupWindow;
25 import android.widget.PopupWindow; 26 import android.widget.PopupWindow;
26 import android.widget.PopupWindow.OnDismissListener; 27 import android.widget.PopupWindow.OnDismissListener;
27 28
29 import org.chromium.base.AnimationFrameTimeHistogram;
28 import org.chromium.base.SysUtils; 30 import org.chromium.base.SysUtils;
29 import org.chromium.chrome.R; 31 import org.chromium.chrome.R;
30 32
31 import java.util.ArrayList; 33 import java.util.ArrayList;
32 import java.util.List; 34 import java.util.List;
33 35
34 /** 36 /**
35 * Shows a popup of menuitems anchored to a host view. When a item is selected w e call 37 * Shows a popup of menuitems anchored to a host view. When a item is selected w e call
36 * Activity.onOptionsItemSelected with the appropriate MenuItem. 38 * Activity.onOptionsItemSelected with the appropriate MenuItem.
37 * - Only visible MenuItems are shown. 39 * - Only visible MenuItems are shown.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 Object animatorObject = view.getTag(R.id.menu_item_enter_anim_id); 331 Object animatorObject = view.getTag(R.id.menu_item_enter_anim_id);
330 if (animatorObject != null) { 332 if (animatorObject != null) {
331 if (builder == null) { 333 if (builder == null) {
332 builder = animation.play((Animator) animatorObject); 334 builder = animation.play((Animator) animatorObject);
333 } else { 335 } else {
334 builder.with((Animator) animatorObject); 336 builder.with((Animator) animatorObject);
335 } 337 }
336 } 338 }
337 } 339 }
338 340
341 animation.addListener(new AnimatorListener() {
David Trainor- moved to gerrit 2015/02/23 18:20:35 AnimatorListenerAdapter then don't include onAnima
Kibeom Kim (inactive) 2015/02/23 22:17:29 Done.
342 private final AnimationFrameTimeHistogram mAnimationFrameTimeHistogr am =
343 new AnimationFrameTimeHistogram("WrenchMenu.OpeningAnimation FrameTimes");
aurimas (slooooooooow) 2015/02/23 18:03:59 Android strongly suggests against new object creat
David Trainor- moved to gerrit 2015/02/23 18:20:35 You're right, but I think they're more concerned w
Kibeom Kim (inactive) 2015/02/23 22:17:29 Done.
344
345 @Override
346 public void onAnimationStart(Animator animation) {
347 mAnimationFrameTimeHistogram.startRecording();
aurimas (slooooooooow) 2015/02/23 18:03:59 How cheap is this call?
Kibeom Kim (inactive) 2015/02/23 18:27:24 I just measured 3 times, release build: 1st run:
348 }
349
350 @Override
351 public void onAnimationRepeat(Animator animation) {
352 }
353
354 @Override
355 public void onAnimationEnd(Animator animation) {
356 mAnimationFrameTimeHistogram.endRecording();
357 }
358
359 @Override
360 public void onAnimationCancel(Animator animation) {
361 mAnimationFrameTimeHistogram.endRecording();
362 }
363 });
364
339 animation.start(); 365 animation.start();
340 } 366 }
341 } 367 }
OLDNEW
« no previous file with comments | « base/time/time_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698