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

Side by Side Diff: components/mus/surfaces/top_level_display_client.cc

Issue 1328953003: Mandoline: Support transforms and clipping of OOPIFs and events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase works! Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/surfaces/top_level_display_client.h" 5 #include "components/mus/surfaces/top_level_display_client.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/surfaces/display.h" 8 #include "cc/surfaces/display.h"
9 #include "cc/surfaces/surface.h"
9 #include "components/mus/gles2/gpu_state.h" 10 #include "components/mus/gles2/gpu_state.h"
10 #include "components/mus/surfaces/surfaces_context_provider.h" 11 #include "components/mus/surfaces/surfaces_context_provider.h"
11 #include "components/mus/surfaces/surfaces_output_surface.h" 12 #include "components/mus/surfaces/surfaces_output_surface.h"
12 #include "components/mus/surfaces/surfaces_scheduler.h" 13 #include "components/mus/surfaces/surfaces_scheduler.h"
13 #include "components/mus/surfaces/surfaces_state.h" 14 #include "components/mus/surfaces/surfaces_state.h"
14 15
15 namespace surfaces { 16 namespace surfaces {
16 namespace { 17 namespace {
17 void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { 18 void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) {
18 callback.Run(); 19 callback.Run();
(...skipping 23 matching lines...) Expand all
42 43
43 display_->Resize(last_submitted_frame_size_); 44 display_->Resize(last_submitted_frame_size_);
44 45
45 // TODO(fsamuel): Plumb the proper device scale factor. 46 // TODO(fsamuel): Plumb the proper device scale factor.
46 display_->SetSurfaceId(cc_id_, 1.f /* device_scale_factor */); 47 display_->SetSurfaceId(cc_id_, 1.f /* device_scale_factor */);
47 } 48 }
48 49
49 void TopLevelDisplayClient::OnContextCreated() {} 50 void TopLevelDisplayClient::OnContextCreated() {}
50 51
51 TopLevelDisplayClient::~TopLevelDisplayClient() { 52 TopLevelDisplayClient::~TopLevelDisplayClient() {
52 if (display_) { 53 factory_.Destroy(cc_id_);
53 factory_.Destroy(cc_id_); 54 surfaces_state_->scheduler()->RemoveDisplay(display_.get());
54 surfaces_state_->scheduler()->RemoveDisplay(display_.get()); 55 // By deleting the object after display_ is reset, OutputSurfaceLost can
55 // By deleting the object after display_ is reset, OutputSurfaceLost can 56 // know not to do anything (which would result in double delete).
56 // know not to do anything (which would result in double delete). 57 delete display_.release();
57 delete display_.release();
58 }
59 } 58 }
60 59
61 void TopLevelDisplayClient::SubmitCompositorFrame( 60 void TopLevelDisplayClient::SubmitCompositorFrame(
62 scoped_ptr<cc::CompositorFrame> frame, 61 scoped_ptr<cc::CompositorFrame> frame,
63 const base::Closure& callback) { 62 const base::Closure& callback) {
64 pending_frame_ = frame.Pass(); 63 pending_frame_ = frame.Pass();
65 64
66 last_submitted_frame_size_ = 65 last_submitted_frame_size_ =
67 pending_frame_->delegated_frame_data->render_pass_list.back() 66 pending_frame_->delegated_frame_data->render_pass_list.back()
68 ->output_rect.size(); 67 ->output_rect.size();
69 display_->Resize(last_submitted_frame_size_); 68 display_->Resize(last_submitted_frame_size_);
70 factory_.SubmitCompositorFrame(cc_id_, pending_frame_.Pass(), 69 factory_.SubmitCompositorFrame(cc_id_, pending_frame_.Pass(),
71 base::Bind(&CallCallback, callback)); 70 base::Bind(&CallCallback, callback));
72 surfaces_state_->scheduler()->SetNeedsDraw(); 71 surfaces_state_->scheduler()->SetNeedsDraw();
73 } 72 }
74 73
74 const cc::CompositorFrame*
75 TopLevelDisplayClient::GetLastCompositorFrame() const {
76 cc::Surface* surface = factory_.manager()->GetSurfaceForId(cc_id_);
77 if (!surface)
78 return nullptr;
79 return surface->GetEligibleFrame();
80 }
81
75 void TopLevelDisplayClient::CommitVSyncParameters(base::TimeTicks timebase, 82 void TopLevelDisplayClient::CommitVSyncParameters(base::TimeTicks timebase,
76 base::TimeDelta interval) {} 83 base::TimeDelta interval) {}
77 84
78 void TopLevelDisplayClient::OutputSurfaceLost() { 85 void TopLevelDisplayClient::OutputSurfaceLost() {
79 if (!display_) // Shutdown case 86 if (!display_) // Shutdown case
80 return; 87 return;
81 88
82 // If our OutputSurface is lost we can't draw until we get a new one. For now, 89 // If our OutputSurface is lost we can't draw until we get a new one. For now,
83 // destroy the display and create a new one when our ContextProvider provides 90 // destroy the display and create a new one when our ContextProvider provides
84 // a new one. 91 // a new one.
(...skipping 13 matching lines...) Expand all
98 base::TimeTicks::FromInternalValue(timebase), 105 base::TimeTicks::FromInternalValue(timebase),
99 base::TimeDelta::FromInternalValue(interval)); 106 base::TimeDelta::FromInternalValue(interval));
100 } 107 }
101 108
102 void TopLevelDisplayClient::ReturnResources( 109 void TopLevelDisplayClient::ReturnResources(
103 const cc::ReturnedResourceArray& resources) { 110 const cc::ReturnedResourceArray& resources) {
104 // TODO(fsamuel): Implement this. 111 // TODO(fsamuel): Implement this.
105 } 112 }
106 113
107 } // namespace surfaces 114 } // namespace surfaces
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698