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

Side by Side Diff: content/browser/renderer_host/browser_compositor_view_mac.mm

Issue 2776973002: DelegatedFrameHost should not create an ExternalBeginFrameSource (Closed)
Patch Set: c Created 3 years, 9 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_host/browser_compositor_view_mac.h" 5 #include "content/browser/renderer_host/browser_compositor_view_mac.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Compute the frame size based on the root render pass rect size. 275 // Compute the frame size based on the root render pass rect size.
276 cc::RenderPass* root_pass = frame.render_pass_list.back().get(); 276 cc::RenderPass* root_pass = frame.render_pass_list.back().get();
277 float scale_factor = frame.metadata.device_scale_factor; 277 float scale_factor = frame.metadata.device_scale_factor;
278 gfx::Size pixel_size = root_pass->output_rect.size(); 278 gfx::Size pixel_size = root_pass->output_rect.size();
279 gfx::Size dip_size = gfx::ConvertSizeToDIP(scale_factor, pixel_size); 279 gfx::Size dip_size = gfx::ConvertSizeToDIP(scale_factor, pixel_size);
280 root_layer_->SetBounds(gfx::Rect(dip_size)); 280 root_layer_->SetBounds(gfx::Rect(dip_size));
281 if (recyclable_compositor_) { 281 if (recyclable_compositor_) {
282 recyclable_compositor_->compositor()->SetScaleAndSize(scale_factor, 282 recyclable_compositor_->compositor()->SetScaleAndSize(scale_factor,
283 pixel_size); 283 pixel_size);
284 } 284 }
285 cc::BeginFrameAck ack(frame.metadata.begin_frame_ack);
286 delegated_frame_host_->SwapDelegatedFrame(compositor_frame_sink_id, 285 delegated_frame_host_->SwapDelegatedFrame(compositor_frame_sink_id,
287 local_surface_id, std::move(frame)); 286 local_surface_id, std::move(frame));
288 if (begin_frame_source_)
289 begin_frame_source_->DidFinishFrame(this, ack);
290 } 287 }
291 288
292 void BrowserCompositorMac::OnBeginFrameDidNotSwap( 289 void BrowserCompositorMac::OnBeginFrameDidNotSwap(
293 const cc::BeginFrameAck& ack) { 290 const cc::BeginFrameAck& ack) {
294 if (begin_frame_source_) 291 delegated_frame_host_->BeginFrameDidNotSwap(ack);
295 begin_frame_source_->DidFinishFrame(this, ack);
296 } 292 }
297 293
298 void BrowserCompositorMac::SetHasTransparentBackground(bool transparent) { 294 void BrowserCompositorMac::SetHasTransparentBackground(bool transparent) {
299 has_transparent_background_ = transparent; 295 has_transparent_background_ = transparent;
300 if (recyclable_compositor_) { 296 if (recyclable_compositor_) {
301 recyclable_compositor_->compositor()->SetHostHasTransparentBackground( 297 recyclable_compositor_->compositor()->SetHostHasTransparentBackground(
302 has_transparent_background_); 298 has_transparent_background_);
303 } 299 }
304 } 300 }
305 301
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 387 }
392 } 388 }
393 389
394 // static 390 // static
395 void BrowserCompositorMac::DisableRecyclingForShutdown() { 391 void BrowserCompositorMac::DisableRecyclingForShutdown() {
396 g_has_shut_down = true; 392 g_has_shut_down = true;
397 g_spare_recyclable_compositors.Get().clear(); 393 g_spare_recyclable_compositors.Get().clear();
398 } 394 }
399 395
400 void BrowserCompositorMac::SetNeedsBeginFrames(bool needs_begin_frames) { 396 void BrowserCompositorMac::SetNeedsBeginFrames(bool needs_begin_frames) {
401 if (needs_begin_frames_ == needs_begin_frames) 397 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames);
402 return;
403
404 needs_begin_frames_ = needs_begin_frames;
405 if (begin_frame_source_) {
406 if (needs_begin_frames_)
407 begin_frame_source_->AddObserver(this);
408 else
409 begin_frame_source_->RemoveObserver(this);
410 }
411 } 398 }
412 399
413 //////////////////////////////////////////////////////////////////////////////// 400 ////////////////////////////////////////////////////////////////////////////////
414 // DelegatedFrameHost, public: 401 // DelegatedFrameHost, public:
415 402
416 ui::Layer* BrowserCompositorMac::DelegatedFrameHostGetLayer() const { 403 ui::Layer* BrowserCompositorMac::DelegatedFrameHostGetLayer() const {
417 return root_layer_.get(); 404 return root_layer_.get();
418 } 405 }
419 406
420 bool BrowserCompositorMac::DelegatedFrameHostIsVisible() const { 407 bool BrowserCompositorMac::DelegatedFrameHostIsVisible() const {
(...skipping 27 matching lines...) Expand all
448 } 435 }
449 436
450 void BrowserCompositorMac::DelegatedFrameHostSendReclaimCompositorResources( 437 void BrowserCompositorMac::DelegatedFrameHostSendReclaimCompositorResources(
451 int compositor_frame_sink_id, 438 int compositor_frame_sink_id,
452 bool is_swap_ack, 439 bool is_swap_ack,
453 const cc::ReturnedResourceArray& resources) { 440 const cc::ReturnedResourceArray& resources) {
454 client_->BrowserCompositorMacSendReclaimCompositorResources( 441 client_->BrowserCompositorMacSendReclaimCompositorResources(
455 compositor_frame_sink_id, is_swap_ack, resources); 442 compositor_frame_sink_id, is_swap_ack, resources);
456 } 443 }
457 444
458 void BrowserCompositorMac::SetBeginFrameSource(cc::BeginFrameSource* source) { 445 void BrowserCompositorMac::OnBeginFrame(const cc::BeginFrameArgs& args) {
459 if (begin_frame_source_ && needs_begin_frames_) 446 client_->BrowserCompositorMacSendBeginFrame(args);
460 begin_frame_source_->RemoveObserver(this);
461 begin_frame_source_ = source;
462 if (begin_frame_source_ && needs_begin_frames_)
463 begin_frame_source_->AddObserver(this);
464 } 447 }
465 448
466 bool BrowserCompositorMac::IsAutoResizeEnabled() const { 449 bool BrowserCompositorMac::IsAutoResizeEnabled() const {
467 NOTREACHED(); 450 NOTREACHED();
468 return false; 451 return false;
469 } 452 }
470 453
471 ////////////////////////////////////////////////////////////////////////////////
472 // cc::BeginFrameSourceBase, public:
473
474 void BrowserCompositorMac::OnBeginFrame(const cc::BeginFrameArgs& args) {
475 client_->BrowserCompositorMacSendBeginFrame(args);
476 last_begin_frame_args_ = args;
477 }
478
479 const cc::BeginFrameArgs& BrowserCompositorMac::LastUsedBeginFrameArgs() const {
480 return last_begin_frame_args_;
481 }
482
483 void BrowserCompositorMac::OnBeginFrameSourcePausedChanged(bool paused) {
484 // Only used on Android WebView.
485 }
486
487 } // namespace content 454 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/browser_compositor_view_mac.h ('k') | content/browser/renderer_host/delegated_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698