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

Side by Side Diff: blimp/client/app/linux/blimp_display_manager.cc

Issue 2266863003: blimp: Move BlimpCompositor to use delegated rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make gn happy Created 4 years, 4 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 | « blimp/client/app/linux/blimp_display_manager.h ('k') | blimp/client/core/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "blimp/client/app/linux/blimp_display_manager.h" 5 #include "blimp/client/app/linux/blimp_display_manager.h"
6 6
7 #include "blimp/client/app/compositor/browser_compositor.h"
7 #include "blimp/client/core/contents/tab_control_feature.h" 8 #include "blimp/client/core/contents/tab_control_feature.h"
9 #include "blimp/client/feature/compositor/blimp_compositor_manager.h"
8 #include "blimp/client/feature/render_widget_feature.h" 10 #include "blimp/client/feature/render_widget_feature.h"
9 #include "ui/events/event.h" 11 #include "ui/events/event.h"
10 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
11 #include "ui/platform_window/platform_window.h" 13 #include "ui/platform_window/platform_window.h"
12 #include "ui/platform_window/x11/x11_window.h" 14 #include "ui/platform_window/x11/x11_window.h"
13 15
14 namespace blimp { 16 namespace blimp {
15 namespace client { 17 namespace client {
16 18
17 BlimpDisplayManager::BlimpDisplayManager( 19 BlimpDisplayManager::BlimpDisplayManager(
18 const gfx::Size& window_size, 20 const gfx::Size& window_size,
19 BlimpDisplayManagerDelegate* delegate, 21 BlimpDisplayManagerDelegate* delegate,
20 RenderWidgetFeature* render_widget_feature, 22 RenderWidgetFeature* render_widget_feature,
21 TabControlFeature* tab_control_feature) 23 TabControlFeature* tab_control_feature)
22 : device_pixel_ratio_(1.f), 24 : device_pixel_ratio_(1.f),
23 delegate_(delegate), 25 delegate_(delegate),
24 tab_control_feature_(tab_control_feature), 26 tab_control_feature_(tab_control_feature),
25 blimp_compositor_manager_( 27 compositor_(base::MakeUnique<BrowserCompositor>()),
26 new BlimpCompositorManager(render_widget_feature, this)),
27 platform_window_(new ui::X11Window(this)) { 28 platform_window_(new ui::X11Window(this)) {
29 blimp_compositor_manager_ = base::MakeUnique<BlimpCompositorManager>(
30 render_widget_feature, BrowserCompositor::GetSurfaceManager(),
31 BrowserCompositor::GetGpuMemoryBufferManager(),
32 base::Bind(&BrowserCompositor::AllocateSurfaceClientId));
28 platform_window_->SetBounds(gfx::Rect(window_size)); 33 platform_window_->SetBounds(gfx::Rect(window_size));
29 platform_window_->Show(); 34 platform_window_->Show();
35
30 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), 36 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(),
31 device_pixel_ratio_); 37 device_pixel_ratio_);
32 38
33 blimp_compositor_manager_->SetVisible(true); 39 compositor_->SetSize(platform_window_->GetBounds().size());
40 compositor_->SetContentLayer(blimp_compositor_manager_->layer());
34 } 41 }
35 42
36 BlimpDisplayManager::~BlimpDisplayManager() {} 43 BlimpDisplayManager::~BlimpDisplayManager() {}
37 44
38 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { 45 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) {
46 compositor_->SetSize(new_bounds.size());
39 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_); 47 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_);
40 } 48 }
41 49
42 void BlimpDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) {}
43
44 void BlimpDisplayManager::DispatchEvent(ui::Event* event) { 50 void BlimpDisplayManager::DispatchEvent(ui::Event* event) {
45 // TODO(dtrainor): Look into using web_input_event_aura to translate these to 51 // TODO(dtrainor): Look into using web_input_event_aura to translate these to
46 // blink events. 52 // blink events.
47 } 53 }
48 54
49 void BlimpDisplayManager::OnCloseRequest() { 55 void BlimpDisplayManager::OnCloseRequest() {
50 blimp_compositor_manager_->SetVisible(false); 56 blimp_compositor_manager_->SetVisible(false);
57 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
51 platform_window_->Close(); 58 platform_window_->Close();
52 } 59 }
53 60
54 void BlimpDisplayManager::OnClosed() { 61 void BlimpDisplayManager::OnClosed() {
55 if (delegate_) 62 if (delegate_)
56 delegate_->OnClosed(); 63 delegate_->OnClosed();
57 } 64 }
58 65
59 void BlimpDisplayManager::OnWindowStateChanged(
60 ui::PlatformWindowState new_state) {}
61
62 void BlimpDisplayManager::OnLostCapture() {}
63
64 void BlimpDisplayManager::OnAcceleratedWidgetAvailable( 66 void BlimpDisplayManager::OnAcceleratedWidgetAvailable(
65 gfx::AcceleratedWidget widget, 67 gfx::AcceleratedWidget widget,
66 float device_pixel_ratio) { 68 float device_pixel_ratio) {
67 device_pixel_ratio_ = device_pixel_ratio; 69 device_pixel_ratio_ = device_pixel_ratio;
68 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), 70 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(),
69 device_pixel_ratio_); 71 device_pixel_ratio_);
70 72
71 if (widget != gfx::kNullAcceleratedWidget) 73 if (widget != gfx::kNullAcceleratedWidget) {
72 blimp_compositor_manager_->SetAcceleratedWidget(widget); 74 blimp_compositor_manager_->SetVisible(true);
75 compositor_->SetAcceleratedWidget(widget);
76 }
73 } 77 }
74 78
75 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { 79 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() {
76 blimp_compositor_manager_->ReleaseAcceleratedWidget(); 80 blimp_compositor_manager_->SetVisible(false);
81 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
77 } 82 }
78 83
79 void BlimpDisplayManager::OnActivationChanged(bool active) {}
80
81 void BlimpDisplayManager::OnSwapBuffersCompleted() {}
82
83 void BlimpDisplayManager::DidCommitAndDrawFrame() {}
84
85 } // namespace client 84 } // namespace client
86 } // namespace blimp 85 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/app/linux/blimp_display_manager.h ('k') | blimp/client/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698