Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ | |
| 6 #define BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ | |
| 7 | |
| 8 #include "base/callback_forward.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "blimp/client/core/compositor/blimp_compositor.h" | |
| 11 #include "ui/gfx/native_widget_types.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 namespace proto { | |
| 15 class CompositorMessage; | |
| 16 } // namespace proto | |
| 17 } // namespace cc | |
| 18 | |
| 19 namespace ui { | |
| 20 class MotionEvent; | |
| 21 } // namespace ui | |
| 22 | |
| 23 namespace blimp { | |
| 24 namespace client { | |
| 25 class BlimpCompositor; | |
| 26 class BlimpRenderWidgetDelegate; | |
| 27 class CompositorDepsProvider; | |
| 28 | |
| 29 // The BlimpRenderWidget is the blimp counterpart to the RenderWidget. This is | |
|
nyquist
2016/08/16 23:14:57
content::RenderWidget?
Khushal
2016/08/18 02:01:46
Done.
| |
| 30 // the model object that owns all the compositing and input state for a render | |
| 31 // widget on the engine, and is our connection to the engine side renderer. | |
| 32 class BlimpRenderWidget : public BlimpCompositorClient { | |
| 33 public: | |
| 34 BlimpRenderWidget(int32_t render_widget_id, | |
| 35 CompositorDepsProvider* compositor_deps_provider, | |
| 36 BlimpRenderWidgetDelegate* delegate); | |
| 37 ~BlimpRenderWidget() override; | |
| 38 | |
| 39 int32_t GetId() const; | |
|
nyquist
2016/08/16 23:14:57
What is this ID? How does it relate to the ID in B
Khushal
2016/08/18 02:01:46
Added a comment.
| |
| 40 | |
| 41 void set_did_swap_buffers_callback(base::Closure callback) { | |
| 42 did_swap_buffers_callback_ = callback; | |
| 43 } | |
| 44 | |
| 45 // The following method is used when the compositor for the renderwidget has | |
| 46 // an on-screen context to draw directly to the native widget. It is legal to | |
| 47 // call this only if use_delegated_rendering is true for the | |
| 48 // CompositorDepsProvider passed when creating the widget. | |
| 49 virtual void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | |
| 50 | |
| 51 virtual void SetVisible(bool visible); | |
| 52 | |
| 53 // Move to the BlimpRenderWidgetView. | |
| 54 bool OnTouchEvent(const ui::MotionEvent& motion_event); | |
| 55 | |
| 56 virtual void OnCompositorMessageReceived( | |
| 57 std::unique_ptr<cc::proto::CompositorMessage> message); | |
| 58 | |
| 59 BlimpCompositor* GetCompositorForTesting() const { return compositor_.get(); } | |
| 60 | |
| 61 private: | |
| 62 friend class BlimpRenderWidgetTest; | |
| 63 class DirectRenderingDeps; | |
| 64 | |
| 65 // BlimpCompositorClient implementation. | |
| 66 void DidCompleteSwapBuffers() override; | |
| 67 void DidCommitAndDrawFrame() override; | |
| 68 void SendWebGestureEvent( | |
| 69 const blink::WebGestureEvent& gesture_event) override; | |
| 70 void SendCompositorMessage( | |
| 71 const cc::proto::CompositorMessage& message) override; | |
| 72 void RequestOutputSurface() override; | |
| 73 | |
| 74 const int32_t render_widget_id_; | |
| 75 | |
| 76 CompositorDepsProvider* compositor_deps_provider_; | |
| 77 BlimpRenderWidgetDelegate* delegate_; | |
| 78 | |
| 79 std::unique_ptr<DirectRenderingDeps> direct_rendering_deps_; | |
| 80 | |
| 81 base::Closure did_swap_buffers_callback_; | |
| 82 | |
| 83 // TODO(khushalsagar): Change this to the remote compositor once it moves to | |
| 84 // cc/blimp. | |
| 85 std::unique_ptr<BlimpCompositor> compositor_; | |
| 86 | |
| 87 DISALLOW_COPY_AND_ASSIGN(BlimpRenderWidget); | |
| 88 }; | |
| 89 | |
| 90 } // namespace client | |
| 91 } // namespace blimp | |
| 92 | |
| 93 #endif // BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ | |
| OLD | NEW |