OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.compositor; | 5 package org.chromium.chrome.browser.compositor; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.PixelFormat; | 8 import android.graphics.PixelFormat; |
9 import android.graphics.drawable.Drawable; | 9 import android.graphics.drawable.Drawable; |
10 import android.view.SurfaceHolder; | 10 import android.view.SurfaceHolder; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // start tear-down of the owned surface; the client notifies us via done
WithUnownedSurface | 180 // start tear-down of the owned surface; the client notifies us via done
WithUnownedSurface |
181 // when it is safe to do that. | 181 // when it is safe to do that. |
182 disownClientSurface(mOwnedByClient); | 182 disownClientSurface(mOwnedByClient); |
183 | 183 |
184 // The client now owns |mRequestedByClient|. Notify it that it's ready. | 184 // The client now owns |mRequestedByClient|. Notify it that it's ready. |
185 mOwnedByClient = mRequestedByClient; | 185 mOwnedByClient = mRequestedByClient; |
186 mClient.surfaceCreated(mOwnedByClient.surfaceHolder()); | 186 mClient.surfaceCreated(mOwnedByClient.surfaceHolder()); |
187 | 187 |
188 // See if we're expecting a surfaceChanged. If not, then send a synthet
ic one. | 188 // See if we're expecting a surfaceChanged. If not, then send a synthet
ic one. |
189 if (mOwnedByClient.format != PixelFormat.UNKNOWN) { | 189 if (mOwnedByClient.format != PixelFormat.UNKNOWN) { |
190 mClient.surfaceChanged(mOwnedByClient.surfaceHolder(), mOwnedByClien
t.width, | 190 mClient.surfaceChanged(mOwnedByClient.surfaceHolder(), mOwnedByClien
t.format, |
191 mOwnedByClient.height, mOwnedByClient.format); | 191 mOwnedByClient.width, mOwnedByClient.height); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 /** | 195 /** |
196 * Called to notify us that the client no longer needs the surface that it d
oesn't own. This | 196 * Called to notify us that the client no longer needs the surface that it d
oesn't own. This |
197 * tells us that we may destroy it. Note that it's okay if it never had an
unowned surface. | 197 * tells us that we may destroy it. Note that it's okay if it never had an
unowned surface. |
198 */ | 198 */ |
199 public void doneWithUnownedSurface() { | 199 public void doneWithUnownedSurface() { |
200 if (mOwnedByClient == null) return; | 200 if (mOwnedByClient == null) return; |
201 | 201 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 state.destroyPending = true; | 472 state.destroyPending = true; |
473 mParentView.post(new Runnable() { | 473 mParentView.post(new Runnable() { |
474 @Override | 474 @Override |
475 public void run() { | 475 public void run() { |
476 detachSurfaceNow(state); | 476 detachSurfaceNow(state); |
477 } | 477 } |
478 }); | 478 }); |
479 } | 479 } |
480 } | 480 } |
OLD | NEW |