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

Side by Side Diff: components/view_manager/display_manager.h

Issue 1149083010: Mandoline: Remove native_viewport.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Windows Build I hope Created 5 years, 6 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 #ifndef COMPONENTS_VIEW_MANAGER_DISPLAY_MANAGER_H_ 5 #ifndef COMPONENTS_VIEW_MANAGER_DISPLAY_MANAGER_H_
6 #define COMPONENTS_VIEW_MANAGER_DISPLAY_MANAGER_H_ 6 #define COMPONENTS_VIEW_MANAGER_DISPLAY_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "components/view_manager/native_viewport/platform_viewport.h"
14 #include "components/view_manager/public/interfaces/display.mojom.h" 15 #include "components/view_manager/public/interfaces/display.mojom.h"
15 #include "components/view_manager/public/interfaces/native_viewport.mojom.h"
16 #include "components/view_manager/public/interfaces/view_manager.mojom.h" 16 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
17 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h" 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
18 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
19 19
20 namespace cc { 20 namespace cc {
21 class SurfaceIdAllocator; 21 class SurfaceIdAllocator;
22 } 22 } // namespace cc
23
24 namespace gles2 {
25 class GpuState;
26 } // namespace gles2
27
28 namespace native_viewport {
29 class OnscreenContextProvider;
30 } // namespace native_viewport
23 31
24 namespace mojo { 32 namespace mojo {
25 class ApplicationImpl; 33 class ApplicationImpl;
26 } 34 } // namespace mojo
27 35
28 namespace view_manager { 36 namespace view_manager {
29 37
38 class EventDispatcher;
30 class ConnectionManager; 39 class ConnectionManager;
31 class ServerView; 40 class ServerView;
32 41
33 // DisplayManager is used to connect the root ServerView to a display. 42 // DisplayManager is used to connect the root ServerView to a display.
34 class DisplayManager { 43 class DisplayManager {
35 public: 44 public:
36 virtual ~DisplayManager() {} 45 virtual ~DisplayManager() {}
37 46
38 virtual void Init( 47 virtual void Init(
39 ConnectionManager* connection_manager, 48 ConnectionManager* connection_manager,
40 mojo::NativeViewportEventDispatcherPtr event_dispatcher) = 0; 49 EventDispatcher* event_dispatcher) = 0;
41 50
42 // Schedules a paint for the specified region in the coordinates of |view|. 51 // Schedules a paint for the specified region in the coordinates of |view|.
43 virtual void SchedulePaint(const ServerView* view, 52 virtual void SchedulePaint(const ServerView* view,
44 const gfx::Rect& bounds) = 0; 53 const gfx::Rect& bounds) = 0;
45 54
46 virtual void SetViewportSize(const gfx::Size& size) = 0; 55 virtual void SetViewportSize(const gfx::Size& size) = 0;
47 56
48 virtual const mojo::ViewportMetrics& GetViewportMetrics() = 0; 57 virtual const mojo::ViewportMetrics& GetViewportMetrics() = 0;
49 }; 58 };
50 59
51 // DisplayManager implementation that connects to the services necessary to 60 // DisplayManager implementation that connects to the services necessary to
52 // actually display. 61 // actually display.
53 class DefaultDisplayManager : public DisplayManager, 62 class DefaultDisplayManager :
54 public mojo::ErrorHandler { 63 public DisplayManager,
64 public native_viewport::PlatformViewport::Delegate {
55 public: 65 public:
56 DefaultDisplayManager( 66 DefaultDisplayManager(
67 bool is_headless,
57 mojo::ApplicationImpl* app_impl, 68 mojo::ApplicationImpl* app_impl,
58 const mojo::Callback<void()>& native_viewport_closed_callback); 69 const scoped_refptr<gles2::GpuState>& gpu_state,
70 const mojo::Callback<void()>& platform_viewport_closed_callback);
59 ~DefaultDisplayManager() override; 71 ~DefaultDisplayManager() override;
60 72
61 // DisplayManager: 73 // DisplayManager:
62 void Init(ConnectionManager* connection_manager, 74 void Init(ConnectionManager* connection_manager,
63 mojo::NativeViewportEventDispatcherPtr event_dispatcher) override; 75 EventDispatcher* event_dispatcher) override;
64 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; 76 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override;
65 void SetViewportSize(const gfx::Size& size) override; 77 void SetViewportSize(const gfx::Size& size) override;
66 const mojo::ViewportMetrics& GetViewportMetrics() override; 78 const mojo::ViewportMetrics& GetViewportMetrics() override;
67 79
68 private: 80 private:
69 void WantToDraw(); 81 void WantToDraw();
70 void Draw(); 82 void Draw();
71 void DidDraw(); 83 void DidDraw();
72 84
73 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics); 85 // PlatformViewport::Delegate implementation:
86 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
87 float device_pixel_ratio) override;
88 void OnAcceleratedWidgetDestroyed() override;
89 void OnEvent(mojo::EventPtr event) override;
90 void OnMetricsChanged(const gfx::Size& size,
91 float device_scale_factor) override;
92 void OnDestroyed() override;
74 93
75 // ErrorHandler: 94 bool is_headless_;
76 void OnConnectionError() override;
77
78 mojo::ApplicationImpl* app_impl_; 95 mojo::ApplicationImpl* app_impl_;
96 scoped_refptr<gles2::GpuState> gpu_state_;
79 ConnectionManager* connection_manager_; 97 ConnectionManager* connection_manager_;
98 EventDispatcher* event_dispatcher_;
80 99
81 mojo::ViewportMetrics metrics_; 100 mojo::ViewportMetrics metrics_;
82 gfx::Rect dirty_rect_; 101 gfx::Rect dirty_rect_;
83 base::Timer draw_timer_; 102 base::Timer draw_timer_;
84 bool frame_pending_; 103 bool frame_pending_;
85 104
86 mojo::DisplayPtr display_; 105 mojo::DisplayPtr display_;
87 mojo::NativeViewportPtr native_viewport_; 106 scoped_ptr<native_viewport::OnscreenContextProvider> context_provider_;
88 mojo::Callback<void()> native_viewport_closed_callback_; 107 scoped_ptr<native_viewport::PlatformViewport> platform_viewport_;
108 mojo::Callback<void()> platform_viewport_closed_callback_;
109
89 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; 110 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_;
90 111
91 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); 112 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager);
92 }; 113 };
93 114
94 } // namespace view_manager 115 } // namespace view_manager
95 116
96 #endif // COMPONENTS_VIEW_MANAGER_DISPLAY_MANAGER_H_ 117 #endif // COMPONENTS_VIEW_MANAGER_DISPLAY_MANAGER_H_
OLDNEW
« no previous file with comments | « components/view_manager/connection_manager.cc ('k') | components/view_manager/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698