OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 last_output_surface_id_(kUndefinedOutputSurfaceId), | 338 last_output_surface_id_(kUndefinedOutputSurfaceId), |
339 gesture_provider_(ui::GetGestureProviderConfig( | 339 gesture_provider_(ui::GetGestureProviderConfig( |
340 ui::GestureProviderConfigType::CURRENT_PLATFORM), | 340 ui::GestureProviderConfigType::CURRENT_PLATFORM), |
341 this), | 341 this), |
342 stylus_text_selector_(this), | 342 stylus_text_selector_(this), |
343 using_browser_compositor_(CompositorImpl::IsInitialized()), | 343 using_browser_compositor_(CompositorImpl::IsInitialized()), |
344 frame_evictor_(new DelegatedFrameEvictor(this)), | 344 frame_evictor_(new DelegatedFrameEvictor(this)), |
345 locks_on_frame_count_(0), | 345 locks_on_frame_count_(0), |
346 observing_root_window_(false), | 346 observing_root_window_(false), |
347 weak_ptr_factory_(this) { | 347 weak_ptr_factory_(this) { |
348 if (CompositorImpl::GetSurfaceManager()) | 348 id_allocator_.reset( |
349 id_allocator_ = CompositorImpl::CreateSurfaceIdAllocator(); | 349 new cc::SurfaceIdAllocator(CompositorImpl::AllocateSurfaceClientId())); |
| 350 CompositorImpl::GetSurfaceManager()->RegisterSurfaceClientId( |
| 351 id_allocator_->client_id()); |
350 host_->SetView(this); | 352 host_->SetView(this); |
351 SetContentViewCore(content_view_core); | 353 SetContentViewCore(content_view_core); |
352 } | 354 } |
353 | 355 |
354 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { | 356 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { |
355 if (content_view_core_) | 357 if (content_view_core_) |
356 content_view_core_->RemoveObserver(this); | 358 content_view_core_->RemoveObserver(this); |
357 SetContentViewCore(NULL); | 359 SetContentViewCore(NULL); |
358 DCHECK(ack_callbacks_.empty()); | 360 DCHECK(ack_callbacks_.empty()); |
359 DCHECK(!surface_factory_); | 361 DCHECK(!surface_factory_); |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 host_->ViewDestroyed(); | 790 host_->ViewDestroyed(); |
789 RemoveLayers(); | 791 RemoveLayers(); |
790 SetContentViewCore(NULL); | 792 SetContentViewCore(NULL); |
791 | 793 |
792 if (!surface_id_.is_null()) { | 794 if (!surface_id_.is_null()) { |
793 DCHECK(surface_factory_.get()); | 795 DCHECK(surface_factory_.get()); |
794 surface_factory_->Destroy(surface_id_); | 796 surface_factory_->Destroy(surface_id_); |
795 surface_id_ = cc::SurfaceId(); | 797 surface_id_ = cc::SurfaceId(); |
796 } | 798 } |
797 surface_factory_.reset(); | 799 surface_factory_.reset(); |
| 800 CompositorImpl::GetSurfaceManager()->InvalidateSurfaceClientId( |
| 801 id_allocator_->client_id()); |
798 | 802 |
799 // The RenderWidgetHost's destruction led here, so don't call it. | 803 // The RenderWidgetHost's destruction led here, so don't call it. |
800 host_ = NULL; | 804 host_ = NULL; |
801 | 805 |
802 delete this; | 806 delete this; |
803 } | 807 } |
804 | 808 |
805 void RenderWidgetHostViewAndroid::SetTooltipText( | 809 void RenderWidgetHostViewAndroid::SetTooltipText( |
806 const base::string16& tooltip_text) { | 810 const base::string16& tooltip_text) { |
807 // Tooltips don't makes sense on Android. | 811 // Tooltips don't makes sense on Android. |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 case ui::MotionEvent::ACTION_UP: | 1982 case ui::MotionEvent::ACTION_UP: |
1979 case ui::MotionEvent::ACTION_POINTER_UP: | 1983 case ui::MotionEvent::ACTION_POINTER_UP: |
1980 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1984 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
1981 delta.InMicroseconds(), 1, 1000000, 50); | 1985 delta.InMicroseconds(), 1, 1000000, 50); |
1982 default: | 1986 default: |
1983 return; | 1987 return; |
1984 } | 1988 } |
1985 } | 1989 } |
1986 | 1990 |
1987 } // namespace content | 1991 } // namespace content |
OLD | NEW |