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

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/compositor/Invalidator.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.compositor;
6
7 /**
8 * The {@link Invalidator} invalidates a client when it is the right time.
9 */
10 public class Invalidator {
11 /**
12 * Interface for the client that gets invalidated.
13 */
14 public interface Client {
15 /**
16 * Do the invalidation.
17 */
18 void doInvalidate();
19 }
20
21 /**
22 * Interface for the host that drives the invalidations.
23 */
24 public interface Host {
25 /**
26 * Requests an invalidation of the view.
27 *
28 * @param view The {@link View} to invalidate.
29 */
30 void deferInvalidate(Client view);
31 }
32
33 private Host mHost;
34
35 /**
36 * @param host The invalidator host, responsible for invalidating views.
37 */
38 public void set(Host host) {
39 mHost = host;
40 }
41
42 /**
43 * Invalidates either immediately (if no host is specified) or at time
44 * triggered by the host.
45 *
46 * @param client The {@link Client} to invalidate, most likely a view.
47 */
48 public void invalidate(Client client) {
49 if (mHost != null) {
50 mHost.deferInvalidate(client);
51 } else {
52 client.doInvalidate();
53 }
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698