| 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 #include "components/view_manager/native_viewport/native_viewport_impl.h" | 5 #include "components/view_manager/native_viewport/native_viewport_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const scoped_refptr<gles2::GpuState>& gpu_state, | 22 const scoped_refptr<gles2::GpuState>& gpu_state, |
| 23 mojo::InterfaceRequest<mojo::NativeViewport> request, | 23 mojo::InterfaceRequest<mojo::NativeViewport> request, |
| 24 scoped_ptr<mojo::AppRefCount> app_refcount) | 24 scoped_ptr<mojo::AppRefCount> app_refcount) |
| 25 : is_headless_(is_headless), | 25 : is_headless_(is_headless), |
| 26 app_refcount_(app_refcount.Pass()), | 26 app_refcount_(app_refcount.Pass()), |
| 27 context_provider_(new OnscreenContextProvider(gpu_state)), | 27 context_provider_(new OnscreenContextProvider(gpu_state)), |
| 28 sent_metrics_(false), | 28 sent_metrics_(false), |
| 29 metrics_(mojo::ViewportMetrics::New()), | 29 metrics_(mojo::ViewportMetrics::New()), |
| 30 binding_(this, request.Pass()), | 30 binding_(this, request.Pass()), |
| 31 weak_factory_(this) { | 31 weak_factory_(this) { |
| 32 binding_.set_error_handler(this); | |
| 33 } | 32 } |
| 34 | 33 |
| 35 NativeViewportImpl::~NativeViewportImpl() { | 34 NativeViewportImpl::~NativeViewportImpl() { |
| 36 // Destroy before |platform_viewport_| because this will destroy | 35 // Destroy before |platform_viewport_| because this will destroy |
| 37 // CommandBufferDriver objects that contain child windows. Otherwise if this | 36 // CommandBufferDriver objects that contain child windows. Otherwise if this |
| 38 // class destroys its window first, X errors will occur. | 37 // class destroys its window first, X errors will occur. |
| 39 context_provider_.reset(); | 38 context_provider_.reset(); |
| 40 | 39 |
| 41 // Destroy the NativeViewport early on as it may call us back during | 40 // Destroy the NativeViewport early on as it may call us back during |
| 42 // destruction and we want to be in a known state. | 41 // destruction and we want to be in a known state. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 152 } |
| 154 | 153 |
| 155 event_dispatcher_->OnEvent(event.Pass(), callback); | 154 event_dispatcher_->OnEvent(event.Pass(), callback); |
| 156 return false; | 155 return false; |
| 157 } | 156 } |
| 158 | 157 |
| 159 void NativeViewportImpl::OnDestroyed() { | 158 void NativeViewportImpl::OnDestroyed() { |
| 160 delete this; | 159 delete this; |
| 161 } | 160 } |
| 162 | 161 |
| 163 void NativeViewportImpl::OnConnectionError() { | |
| 164 binding_.set_error_handler(nullptr); | |
| 165 delete this; | |
| 166 } | |
| 167 | |
| 168 void NativeViewportImpl::AckEvent(int32 pointer_id) { | 162 void NativeViewportImpl::AckEvent(int32 pointer_id) { |
| 169 pointers_waiting_on_ack_.erase(pointer_id); | 163 pointers_waiting_on_ack_.erase(pointer_id); |
| 170 } | 164 } |
| 171 | 165 |
| 172 } // namespace native_viewport | 166 } // namespace native_viewport |
| OLD | NEW |