Skip to content

Commit

Permalink
aw: Reset parent draw constraints on tear down
Browse files Browse the repository at this point in the history
Without this, the same webview getting attached again but at a different
part of the view tree would be getting stale and completely wrong parent
draw constraints.

A classic example of this is when webview going into full screen video
mode.

BUG=

Review URL: https://codereview.chromium.org/486833002

Cr-Commit-Position: refs/heads/master@{#290450}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290450 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
boliu@chromium.org committed Aug 19, 2014
1 parent 2fd51e3 commit 2e263cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions android_webview/browser/hardware_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ HardwareRenderer::~HardwareRenderer() {
#endif // DCHECK_IS_ON

resource_collection_->SetClient(NULL);

// Reset draw constraints.
shared_renderer_state_->UpdateDrawConstraints(
ParentCompositorDrawConstraints());
}

void HardwareRenderer::DidBeginMainFrame() {
Expand Down
11 changes: 7 additions & 4 deletions android_webview/browser/shared_renderer_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,15 @@ scoped_ptr<DrawGLInput> SharedRendererState::PassDrawGLInput() {
return draw_gl_input_.Pass();
}

void SharedRendererState::UpdateDrawConstraints(
const ParentCompositorDrawConstraints& parent_draw_constraints) {
base::AutoLock lock(lock_);
parent_draw_constraints_ = parent_draw_constraints;
}

void SharedRendererState::PostExternalDrawConstraintsToChildCompositor(
const ParentCompositorDrawConstraints& parent_draw_constraints) {
{
base::AutoLock lock(lock_);
parent_draw_constraints_ = parent_draw_constraints;
}
UpdateDrawConstraints(parent_draw_constraints);

// No need to hold the lock_ during the post task.
ui_loop_->PostTask(
Expand Down
2 changes: 2 additions & 0 deletions android_webview/browser/shared_renderer_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class SharedRendererState {
scoped_ptr<DrawGLInput> PassDrawGLInput();

bool IsInsideHardwareRelease() const;
void UpdateDrawConstraints(
const ParentCompositorDrawConstraints& parent_draw_constraints);
void PostExternalDrawConstraintsToChildCompositor(
const ParentCompositorDrawConstraints& parent_draw_constraints);

Expand Down

0 comments on commit 2e263cc

Please sign in to comment.