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

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: tests work. 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
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 visible_(true),
26 new BlimpCompositorManager(render_widget_feature, this)), 28 widget_(gfx::kNullAcceleratedWidget),
29 compositor_(base::MakeUnique<BrowserCompositor>()),
27 platform_window_(new ui::X11Window(this)) { 30 platform_window_(new ui::X11Window(this)) {
31 blimp_compositor_manager_ = base::MakeUnique<BlimpCompositorManager>(
32 render_widget_feature, BrowserCompositor::GetSurfaceManager(),
33 BrowserCompositor::GetGpuMemoryBufferManager(),
34 base::Bind(&BrowserCompositor::AllocateSurfaceClientId));
35 blimp_compositor_manager_->SetVisible(visible_);
36
28 platform_window_->SetBounds(gfx::Rect(window_size)); 37 platform_window_->SetBounds(gfx::Rect(window_size));
29 platform_window_->Show(); 38 platform_window_->Show();
39
30 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), 40 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(),
31 device_pixel_ratio_); 41 device_pixel_ratio_);
32 42
33 blimp_compositor_manager_->SetVisible(true); 43 compositor_->SetSize(platform_window_->GetBounds().size());
44 compositor_->SetContentLayer(blimp_compositor_manager_->layer());
34 } 45 }
35 46
36 BlimpDisplayManager::~BlimpDisplayManager() {} 47 BlimpDisplayManager::~BlimpDisplayManager() {}
37 48
38 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { 49 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) {
50 compositor_->SetSize(new_bounds.size());
39 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_); 51 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_);
40 } 52 }
41 53
42 void BlimpDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) {}
43
44 void BlimpDisplayManager::DispatchEvent(ui::Event* event) { 54 void BlimpDisplayManager::DispatchEvent(ui::Event* event) {
45 // TODO(dtrainor): Look into using web_input_event_aura to translate these to 55 // TODO(dtrainor): Look into using web_input_event_aura to translate these to
46 // blink events. 56 // blink events.
47 } 57 }
48 58
49 void BlimpDisplayManager::OnCloseRequest() { 59 void BlimpDisplayManager::OnCloseRequest() {
50 blimp_compositor_manager_->SetVisible(false); 60 blimp_compositor_manager_->SetVisible(false);
61 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
51 platform_window_->Close(); 62 platform_window_->Close();
52 } 63 }
53 64
54 void BlimpDisplayManager::OnClosed() { 65 void BlimpDisplayManager::OnClosed() {
55 if (delegate_) 66 if (delegate_)
56 delegate_->OnClosed(); 67 delegate_->OnClosed();
57 } 68 }
58 69
59 void BlimpDisplayManager::OnWindowStateChanged(
60 ui::PlatformWindowState new_state) {}
61
62 void BlimpDisplayManager::OnLostCapture() {}
63
64 void BlimpDisplayManager::OnAcceleratedWidgetAvailable( 70 void BlimpDisplayManager::OnAcceleratedWidgetAvailable(
65 gfx::AcceleratedWidget widget, 71 gfx::AcceleratedWidget widget,
66 float device_pixel_ratio) { 72 float device_pixel_ratio) {
67 device_pixel_ratio_ = device_pixel_ratio; 73 device_pixel_ratio_ = device_pixel_ratio;
68 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), 74 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(),
69 device_pixel_ratio_); 75 device_pixel_ratio_);
70 76
71 if (widget != gfx::kNullAcceleratedWidget) 77 if (widget != gfx::kNullAcceleratedWidget) {
72 blimp_compositor_manager_->SetAcceleratedWidget(widget); 78 widget_ = widget;
79 if (visible_)
80 compositor_->SetAcceleratedWidget(widget_);
81 }
73 } 82 }
74 83
75 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { 84 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() {
76 blimp_compositor_manager_->ReleaseAcceleratedWidget(); 85 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
77 } 86 }
78 87
79 void BlimpDisplayManager::OnActivationChanged(bool active) {}
80
81 void BlimpDisplayManager::OnSwapBuffersCompleted() {}
82
83 void BlimpDisplayManager::DidCommitAndDrawFrame() {}
84
85 } // namespace client 88 } // namespace client
86 } // namespace blimp 89 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698