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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.cc

Issue 1159883005: Fix crash in sync compositor registration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/android/in_process/synchronous_compositor_impl.h" 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 UpdateNeedsBeginFrames(); 267 UpdateNeedsBeginFrames();
268 } 268 }
269 269
270 void SynchronousCompositorImpl::OnNeedsBeginFramesChange( 270 void SynchronousCompositorImpl::OnNeedsBeginFramesChange(
271 bool needs_begin_frames) { 271 bool needs_begin_frames) {
272 renderer_needs_begin_frames_ = needs_begin_frames; 272 renderer_needs_begin_frames_ = needs_begin_frames;
273 UpdateNeedsBeginFrames(); 273 UpdateNeedsBeginFrames();
274 } 274 }
275 275
276 void SynchronousCompositorImpl::BeginFrame(const cc::BeginFrameArgs& args) { 276 void SynchronousCompositorImpl::BeginFrame(const cc::BeginFrameArgs& args) {
277 if (!registered_with_client_) { 277 if (!registered_with_client_ && is_active_ && renderer_needs_begin_frames_) {
278 // Make sure this is a BeginFrame that renderer side explicitly requested.
279 // Otherwise it is possible renderer objects not initialized.
278 RegisterWithClient(); 280 RegisterWithClient();
279 DCHECK(registered_with_client_); 281 DCHECK(registered_with_client_);
280 } 282 }
281 if (begin_frame_source_) 283 if (begin_frame_source_)
282 begin_frame_source_->BeginFrame(args); 284 begin_frame_source_->BeginFrame(args);
283 } 285 }
284 286
285 void SynchronousCompositorImpl::UpdateNeedsBeginFrames() { 287 void SynchronousCompositorImpl::UpdateNeedsBeginFrames() {
286 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( 288 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>(
287 contents_->GetRenderWidgetHostView()); 289 contents_->GetRenderWidgetHostView());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 g_factory.Get(); // Ensure it's initialized. 390 g_factory.Get(); // Ensure it's initialized.
389 SynchronousCompositorImpl::CreateForWebContents(contents); 391 SynchronousCompositorImpl::CreateForWebContents(contents);
390 } 392 }
391 SynchronousCompositorImpl* instance = 393 SynchronousCompositorImpl* instance =
392 SynchronousCompositorImpl::FromWebContents(contents); 394 SynchronousCompositorImpl::FromWebContents(contents);
393 DCHECK(instance); 395 DCHECK(instance);
394 instance->SetClient(client); 396 instance->SetClient(client);
395 } 397 }
396 398
397 } // namespace content 399 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698