Skip to content

Commit

Permalink
Add requestDrawGL method in InternalAccessDelegate
Browse files Browse the repository at this point in the history
so, compositor (via AwContents) can request a GL functor callback outside of draw cycle.

BUG=233284

Review URL: https://chromiumcodereview.appspot.com/13877017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195746 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
michaelbai@chromium.org committed Apr 23, 2013
1 parent 147408a commit 33af16f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ public interface InternalAccessDelegate extends ContentViewCore.InternalAccessDe
* @see View#setMeasuredDimension(int, int)
*/
void setMeasuredDimension(int measuredWidth, int measuredHeight);

/**
* Requests a callback on the native DrawGL method (see getAwDrawGLFunction)
* if called from within onDraw, |canvas| will be non-null and hardware accelerated.
* otherwise, |canvas| will be null, and the container view itself will be hardware
* accelerated.
*
* @return false indicates the GL draw request was not accepted, and the caller
* should fallback to the SW path.
*/
boolean requestDrawGL(Canvas canvas);
}

private int mNativeAwContents;
Expand Down Expand Up @@ -390,6 +401,7 @@ public int getAwDrawGLViewContext() {
return nativeGetAwDrawGLViewContext(mNativeAwContents);
}

// TODO(michaelbai) : Remove this method once it is not called.
public boolean onPrepareDrawGL(Canvas canvas) {
if (mNativeAwContents == 0) return false;
nativeSetScrollForHWFrame(mNativeAwContents,
Expand All @@ -401,6 +413,10 @@ public boolean onPrepareDrawGL(Canvas canvas) {

public void onDraw(Canvas canvas) {
if (mNativeAwContents == 0) return;
if (canvas.isHardwareAccelerated() && onPrepareDrawGL(canvas) &&
mInternalAccessAdapter.requestDrawGL(canvas)) {
return;
}
Rect clip = canvas.getClipBounds();
if (!nativeDrawSW(mNativeAwContents, canvas, clip.left, clip.top,
clip.right - clip.left, clip.bottom - clip.top)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,10 @@ public boolean super_awakenScrollBars(int startDelay, boolean invalidate) {
public void setMeasuredDimension(int measuredWidth, int measuredHeight) {
AwTestContainerView.super.setMeasuredDimension(measuredWidth, measuredHeight);
}

@Override
public boolean requestDrawGL(Canvas canvas) {
return false;
}
}
}

0 comments on commit 33af16f

Please sign in to comment.