Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ | 5 #ifndef SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ |
| 6 #define SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ | 6 #define SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | |
| 9 | |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h" | 13 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h" |
| 12 #include "mojo/services/native_viewport/public/interfaces/native_viewport.mojom. h" | 14 #include "mojo/services/native_viewport/public/interfaces/native_viewport.mojom. h" |
| 13 #include "services/native_viewport/onscreen_context_provider.h" | 15 #include "services/native_viewport/onscreen_context_provider.h" |
| 14 #include "services/native_viewport/platform_viewport.h" | 16 #include "services/native_viewport/platform_viewport.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 16 | 18 |
| 17 namespace gles2 { | 19 namespace gles2 { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 // PlatformViewport::Delegate implementation. | 54 // PlatformViewport::Delegate implementation. |
| 53 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) override; | 55 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) override; |
| 54 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; | 56 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; |
| 55 void OnAcceleratedWidgetDestroyed() override; | 57 void OnAcceleratedWidgetDestroyed() override; |
| 56 bool OnEvent(mojo::EventPtr event) override; | 58 bool OnEvent(mojo::EventPtr event) override; |
| 57 void OnDestroyed() override; | 59 void OnDestroyed() override; |
| 58 | 60 |
| 59 // mojo::ErrorHandler implementation. | 61 // mojo::ErrorHandler implementation. |
| 60 void OnConnectionError() override; | 62 void OnConnectionError() override; |
| 61 | 63 |
| 62 void AckEvent(); | 64 private: |
| 65 // Used by AckEvent; see it for details. | |
| 66 struct PointerId { | |
| 67 int32 id; | |
|
qsr
2015/03/24 08:20:22
I am missing something, but why do you need this o
sky
2015/03/24 13:18:21
I did this as I thought it a bit mysterious to tak
| |
| 68 }; | |
| 63 | 69 |
| 64 private: | 70 // Callback when the dispatcher has processed a message we're waiting on |
| 71 // an ack from. |id->id| identifies the pointer the message was associated | |
| 72 // with. Receiver does not own supplied value (its owned by the callback). | |
| 73 void AckEvent(PointerId* id); | |
| 74 | |
| 65 bool is_headless_; | 75 bool is_headless_; |
| 66 scoped_ptr<PlatformViewport> platform_viewport_; | 76 scoped_ptr<PlatformViewport> platform_viewport_; |
| 67 OnscreenContextProvider context_provider_; | 77 OnscreenContextProvider context_provider_; |
| 68 bool sent_metrics_; | 78 bool sent_metrics_; |
| 69 mojo::ViewportMetricsPtr metrics_; | 79 mojo::ViewportMetricsPtr metrics_; |
| 70 bool waiting_for_event_ack_; | |
| 71 CreateCallback create_callback_; | 80 CreateCallback create_callback_; |
| 72 RequestMetricsCallback metrics_callback_; | 81 RequestMetricsCallback metrics_callback_; |
| 73 mojo::NativeViewportEventDispatcherPtr event_dispatcher_; | 82 mojo::NativeViewportEventDispatcherPtr event_dispatcher_; |
| 74 mojo::Binding<mojo::NativeViewport> binding_; | 83 mojo::Binding<mojo::NativeViewport> binding_; |
| 75 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; | 84 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; |
| 76 | 85 |
| 86 // Set of pointer_ids we've sent a move to and are waiting on an ack. | |
| 87 std::set<int32> pointers_waiting_on_ack_; | |
| 88 | |
| 77 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); | 89 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); |
| 78 }; | 90 }; |
| 79 | 91 |
| 80 } // namespace native_viewport | 92 } // namespace native_viewport |
| 81 | 93 |
| 82 #endif // SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ | 94 #endif // SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ |
| OLD | NEW |