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

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

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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/view_manager/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 "components/view_manager/gles2/gpu_state.h" 9 #include "components/mus/gles2/gpu_state.h"
10 #include "components/view_manager/surfaces/surfaces_context_provider.h" 10 #include "components/mus/surfaces/surfaces_context_provider.h"
11 #include "components/view_manager/surfaces/surfaces_output_surface.h" 11 #include "components/mus/surfaces/surfaces_output_surface.h"
12 #include "components/view_manager/surfaces/surfaces_scheduler.h" 12 #include "components/mus/surfaces/surfaces_scheduler.h"
13 #include "components/view_manager/surfaces/surfaces_state.h" 13 #include "components/mus/surfaces/surfaces_state.h"
14 14
15 namespace surfaces { 15 namespace surfaces {
16 namespace { 16 namespace {
17 void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { 17 void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) {
18 callback.Run(); 18 callback.Run();
19 } 19 }
20 } 20 }
21 21
22 TopLevelDisplayClient::TopLevelDisplayClient( 22 TopLevelDisplayClient::TopLevelDisplayClient(
23 gfx::AcceleratedWidget widget, 23 gfx::AcceleratedWidget widget,
(...skipping 15 matching lines...) Expand all
39 make_scoped_ptr(new surfaces::DirectOutputSurface( 39 make_scoped_ptr(new surfaces::DirectOutputSurface(
40 new SurfacesContextProvider(this, widget, gpu_state))), 40 new SurfacesContextProvider(this, widget, gpu_state))),
41 null_display_scheduler); 41 null_display_scheduler);
42 42
43 display_->Resize(last_submitted_frame_size_); 43 display_->Resize(last_submitted_frame_size_);
44 44
45 // TODO(fsamuel): Plumb the proper device scale factor. 45 // TODO(fsamuel): Plumb the proper device scale factor.
46 display_->SetSurfaceId(cc_id_, 1.f /* device_scale_factor */); 46 display_->SetSurfaceId(cc_id_, 1.f /* device_scale_factor */);
47 } 47 }
48 48
49 void TopLevelDisplayClient::OnContextCreated() { 49 void TopLevelDisplayClient::OnContextCreated() {}
50 }
51 50
52 TopLevelDisplayClient::~TopLevelDisplayClient() { 51 TopLevelDisplayClient::~TopLevelDisplayClient() {
53 if (display_) { 52 if (display_) {
54 factory_.Destroy(cc_id_); 53 factory_.Destroy(cc_id_);
55 surfaces_state_->scheduler()->RemoveDisplay(display_.get()); 54 surfaces_state_->scheduler()->RemoveDisplay(display_.get());
56 // By deleting the object after display_ is reset, OutputSurfaceLost can 55 // By deleting the object after display_ is reset, OutputSurfaceLost can
57 // know not to do anything (which would result in double delete). 56 // know not to do anything (which would result in double delete).
58 delete display_.release(); 57 delete display_.release();
59 } 58 }
60 } 59 }
61 60
62 void TopLevelDisplayClient::SubmitCompositorFrame( 61 void TopLevelDisplayClient::SubmitCompositorFrame(
63 scoped_ptr<cc::CompositorFrame> frame, 62 scoped_ptr<cc::CompositorFrame> frame,
64 const base::Closure& callback) { 63 const base::Closure& callback) {
65 pending_frame_ = frame.Pass(); 64 pending_frame_ = frame.Pass();
66 65
67 last_submitted_frame_size_ = 66 last_submitted_frame_size_ =
68 pending_frame_->delegated_frame_data->render_pass_list.back()-> 67 pending_frame_->delegated_frame_data->render_pass_list.back()
69 output_rect.size(); 68 ->output_rect.size();
70 display_->Resize(last_submitted_frame_size_); 69 display_->Resize(last_submitted_frame_size_);
71 factory_.SubmitCompositorFrame(cc_id_, pending_frame_.Pass(), 70 factory_.SubmitCompositorFrame(cc_id_, pending_frame_.Pass(),
72 base::Bind(&CallCallback, callback)); 71 base::Bind(&CallCallback, callback));
73 surfaces_state_->scheduler()->SetNeedsDraw(); 72 surfaces_state_->scheduler()->SetNeedsDraw();
74 } 73 }
75 74
76 void TopLevelDisplayClient::CommitVSyncParameters(base::TimeTicks timebase, 75 void TopLevelDisplayClient::CommitVSyncParameters(base::TimeTicks timebase,
77 base::TimeDelta interval) { 76 base::TimeDelta interval) {}
78 }
79 77
80 void TopLevelDisplayClient::OutputSurfaceLost() { 78 void TopLevelDisplayClient::OutputSurfaceLost() {
81 if (!display_) // Shutdown case 79 if (!display_) // Shutdown case
82 return; 80 return;
83 81
84 // If our OutputSurface is lost we can't draw until we get a new one. For now, 82 // If our OutputSurface is lost we can't draw until we get a new one. For now,
85 // destroy the display and create a new one when our ContextProvider provides 83 // destroy the display and create a new one when our ContextProvider provides
86 // a new one. 84 // a new one.
87 // TODO: This is more violent than necessary - we could simply remove this 85 // TODO: This is more violent than necessary - we could simply remove this
88 // display from the scheduler's set and pass a new context in to the 86 // display from the scheduler's set and pass a new context in to the
89 // OutputSurface. It should be able to reinitialize properly. 87 // OutputSurface. It should be able to reinitialize properly.
90 surfaces_state_->scheduler()->RemoveDisplay(display_.get()); 88 surfaces_state_->scheduler()->RemoveDisplay(display_.get());
91 display_.reset(); 89 display_.reset();
92 } 90 }
93 91
94 void TopLevelDisplayClient::SetMemoryPolicy( 92 void TopLevelDisplayClient::SetMemoryPolicy(
95 const cc::ManagedMemoryPolicy& policy) { 93 const cc::ManagedMemoryPolicy& policy) {}
96 }
97 94
98 void TopLevelDisplayClient::OnVSyncParametersUpdated(int64_t timebase, 95 void TopLevelDisplayClient::OnVSyncParametersUpdated(int64_t timebase,
99 int64_t interval) { 96 int64_t interval) {
100 surfaces_state_->scheduler()->OnVSyncParametersUpdated( 97 surfaces_state_->scheduler()->OnVSyncParametersUpdated(
101 base::TimeTicks::FromInternalValue(timebase), 98 base::TimeTicks::FromInternalValue(timebase),
102 base::TimeDelta::FromInternalValue(interval)); 99 base::TimeDelta::FromInternalValue(interval));
103 } 100 }
104 101
105 void TopLevelDisplayClient::ReturnResources( 102 void TopLevelDisplayClient::ReturnResources(
106 const cc::ReturnedResourceArray& resources) { 103 const cc::ReturnedResourceArray& resources) {
107 // TODO(fsamuel): Implement this. 104 // TODO(fsamuel): Implement this.
108 } 105 }
109 106
110 } // namespace surfaces 107 } // namespace surfaces
OLDNEW
« no previous file with comments | « components/mus/surfaces/top_level_display_client.h ('k') | components/mus/test_change_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698