Chromium Code Reviews| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 | 546 |
| 547 void RenderWidgetHostViewAndroid::LockCompositingSurface() { | 547 void RenderWidgetHostViewAndroid::LockCompositingSurface() { |
| 548 DCHECK(HasValidFrame()); | 548 DCHECK(HasValidFrame()); |
| 549 DCHECK(host_); | 549 DCHECK(host_); |
| 550 DCHECK(frame_evictor_->HasFrame()); | 550 DCHECK(frame_evictor_->HasFrame()); |
| 551 frame_evictor_->LockFrame(); | 551 frame_evictor_->LockFrame(); |
| 552 locks_on_frame_count_++; | 552 locks_on_frame_count_++; |
| 553 } | 553 } |
| 554 | 554 |
| 555 void RenderWidgetHostViewAndroid::UnlockCompositingSurface() { | 555 void RenderWidgetHostViewAndroid::UnlockCompositingSurface() { |
| 556 if (!frame_evictor_->HasFrame() || locks_on_frame_count_ == 0) | 556 if (!frame_evictor_->HasFrame()) { |
| 557 DCHECK_EQ(locks_on_frame_count_, 0u); | |
| 557 return; | 558 return; |
| 559 } | |
| 558 | 560 |
| 559 DCHECK(HasValidFrame()); | 561 DCHECK(HasValidFrame()); |
| 562 locks_on_frame_count_--; | |
| 560 frame_evictor_->UnlockFrame(); | 563 frame_evictor_->UnlockFrame(); |
| 561 locks_on_frame_count_--; | |
| 562 | 564 |
| 563 if (locks_on_frame_count_ == 0) { | 565 if (locks_on_frame_count_ == 0) { |
| 564 if (last_frame_info_) { | 566 if (last_frame_info_) { |
| 565 InternalSwapCompositorFrame(last_frame_info_->output_surface_id, | 567 InternalSwapCompositorFrame(last_frame_info_->output_surface_id, |
| 566 std::move(last_frame_info_->frame)); | 568 std::move(last_frame_info_->frame)); |
| 567 last_frame_info_.reset(); | 569 last_frame_info_.reset(); |
| 568 } | 570 } |
| 569 | 571 |
| 570 if (!is_showing_ && layer_.get()) | 572 if (!is_showing_ && layer_.get()) |
| 571 layer_->SetHideLayerAndSubtree(true); | 573 layer_->SetHideLayerAndSubtree(true); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 799 void RenderWidgetHostViewAndroid::FocusedNodeChanged(bool is_editable_node) { | 801 void RenderWidgetHostViewAndroid::FocusedNodeChanged(bool is_editable_node) { |
| 800 ime_adapter_android_.FocusedNodeChanged(is_editable_node); | 802 ime_adapter_android_.FocusedNodeChanged(is_editable_node); |
| 801 } | 803 } |
| 802 | 804 |
| 803 void RenderWidgetHostViewAndroid::RenderProcessGone( | 805 void RenderWidgetHostViewAndroid::RenderProcessGone( |
| 804 base::TerminationStatus status, int error_code) { | 806 base::TerminationStatus status, int error_code) { |
| 805 Destroy(); | 807 Destroy(); |
| 806 } | 808 } |
| 807 | 809 |
| 808 void RenderWidgetHostViewAndroid::Destroy() { | 810 void RenderWidgetHostViewAndroid::Destroy() { |
| 811 host_->ViewDestroyed(); | |
| 809 RemoveLayers(); | 812 RemoveLayers(); |
| 810 SetContentViewCore(NULL); | 813 SetContentViewCore(NULL); |
| 811 | 814 |
| 812 if (!surface_id_.is_null()) { | 815 if (!surface_id_.is_null()) { |
| 813 DCHECK(surface_factory_.get()); | 816 DCHECK(surface_factory_.get()); |
| 814 surface_factory_->Destroy(surface_id_); | 817 surface_factory_->Destroy(surface_id_); |
| 815 surface_id_ = cc::SurfaceId(); | 818 surface_id_ = cc::SurfaceId(); |
| 816 } | 819 } |
| 817 surface_factory_.reset(); | 820 surface_factory_.reset(); |
| 818 | 821 |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 if (selection_controller_) | 1494 if (selection_controller_) |
| 1492 needs_animate |= selection_controller_->Animate(frame_time); | 1495 needs_animate |= selection_controller_->Animate(frame_time); |
| 1493 return needs_animate; | 1496 return needs_animate; |
| 1494 } | 1497 } |
| 1495 | 1498 |
| 1496 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { | 1499 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { |
| 1497 if (content_view_core_) | 1500 if (content_view_core_) |
| 1498 content_view_core_->RequestDisallowInterceptTouchEvent(); | 1501 content_view_core_->RequestDisallowInterceptTouchEvent(); |
| 1499 } | 1502 } |
| 1500 | 1503 |
| 1501 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { | 1504 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { |
|
no sievers
2016/03/21 21:42:44
you can DCHECK_EQ(locks_on_frame_count_, 0u) here
Jinsuk Kim
2016/03/21 22:28:20
Done.
| |
| 1505 frame_evictor_->DiscardedFrame(); | |
| 1502 if (layer_.get()) | 1506 if (layer_.get()) |
| 1503 DestroyDelegatedContent(); | 1507 DestroyDelegatedContent(); |
| 1504 frame_evictor_->DiscardedFrame(); | |
| 1505 } | 1508 } |
| 1506 | 1509 |
| 1507 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( | 1510 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( |
| 1508 const gfx::Size& desired_size) { | 1511 const gfx::Size& desired_size) { |
| 1509 NOTREACHED(); | 1512 NOTREACHED(); |
| 1510 return false; | 1513 return false; |
| 1511 } | 1514 } |
| 1512 | 1515 |
| 1513 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { | 1516 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { |
| 1514 // ScreenInfo isn't tied to the widget on Android. Always return the default. | 1517 // ScreenInfo isn't tied to the widget on Android. Always return the default. |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2019 results->orientationAngle = display.RotationAsDegree(); | 2022 results->orientationAngle = display.RotationAsDegree(); |
| 2020 results->orientationType = | 2023 results->orientationType = |
| 2021 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2024 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2022 gfx::DeviceDisplayInfo info; | 2025 gfx::DeviceDisplayInfo info; |
| 2023 results->depth = info.GetBitsPerPixel(); | 2026 results->depth = info.GetBitsPerPixel(); |
| 2024 results->depthPerComponent = info.GetBitsPerComponent(); | 2027 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2025 results->isMonochrome = (results->depthPerComponent == 0); | 2028 results->isMonochrome = (results->depthPerComponent == 0); |
| 2026 } | 2029 } |
| 2027 | 2030 |
| 2028 } // namespace content | 2031 } // namespace content |
| OLD | NEW |