| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 void RenderWidgetHostViewAndroid::FocusedNodeChanged(bool is_editable_node) { | 797 void RenderWidgetHostViewAndroid::FocusedNodeChanged(bool is_editable_node) { |
| 796 ime_adapter_android_.FocusedNodeChanged(is_editable_node); | 798 ime_adapter_android_.FocusedNodeChanged(is_editable_node); |
| 797 } | 799 } |
| 798 | 800 |
| 799 void RenderWidgetHostViewAndroid::RenderProcessGone( | 801 void RenderWidgetHostViewAndroid::RenderProcessGone( |
| 800 base::TerminationStatus status, int error_code) { | 802 base::TerminationStatus status, int error_code) { |
| 801 Destroy(); | 803 Destroy(); |
| 802 } | 804 } |
| 803 | 805 |
| 804 void RenderWidgetHostViewAndroid::Destroy() { | 806 void RenderWidgetHostViewAndroid::Destroy() { |
| 807 host_->ViewDestroyed(); |
| 805 RemoveLayers(); | 808 RemoveLayers(); |
| 806 SetContentViewCore(NULL); | 809 SetContentViewCore(NULL); |
| 807 | 810 |
| 808 if (!surface_id_.is_null()) { | 811 if (!surface_id_.is_null()) { |
| 809 DCHECK(surface_factory_.get()); | 812 DCHECK(surface_factory_.get()); |
| 810 surface_factory_->Destroy(surface_id_); | 813 surface_factory_->Destroy(surface_id_); |
| 811 surface_id_ = cc::SurfaceId(); | 814 surface_id_ = cc::SurfaceId(); |
| 812 } | 815 } |
| 813 surface_factory_.reset(); | 816 surface_factory_.reset(); |
| 814 | 817 |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 needs_animate |= selection_controller_->Animate(frame_time); | 1499 needs_animate |= selection_controller_->Animate(frame_time); |
| 1497 return needs_animate; | 1500 return needs_animate; |
| 1498 } | 1501 } |
| 1499 | 1502 |
| 1500 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { | 1503 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { |
| 1501 if (content_view_core_) | 1504 if (content_view_core_) |
| 1502 content_view_core_->RequestDisallowInterceptTouchEvent(); | 1505 content_view_core_->RequestDisallowInterceptTouchEvent(); |
| 1503 } | 1506 } |
| 1504 | 1507 |
| 1505 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { | 1508 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { |
| 1509 DCHECK_EQ(locks_on_frame_count_, 0u); |
| 1510 frame_evictor_->DiscardedFrame(); |
| 1506 if (layer_.get()) | 1511 if (layer_.get()) |
| 1507 DestroyDelegatedContent(); | 1512 DestroyDelegatedContent(); |
| 1508 frame_evictor_->DiscardedFrame(); | |
| 1509 } | 1513 } |
| 1510 | 1514 |
| 1511 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( | 1515 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( |
| 1512 const gfx::Size& desired_size) { | 1516 const gfx::Size& desired_size) { |
| 1513 NOTREACHED(); | 1517 NOTREACHED(); |
| 1514 return false; | 1518 return false; |
| 1515 } | 1519 } |
| 1516 | 1520 |
| 1517 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { | 1521 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { |
| 1518 // ScreenInfo isn't tied to the widget on Android. Always return the default. | 1522 // ScreenInfo isn't tied to the widget on Android. Always return the default. |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 results->orientationAngle = display.RotationAsDegree(); | 2048 results->orientationAngle = display.RotationAsDegree(); |
| 2045 results->orientationType = | 2049 results->orientationType = |
| 2046 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2050 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2047 gfx::DeviceDisplayInfo info; | 2051 gfx::DeviceDisplayInfo info; |
| 2048 results->depth = info.GetBitsPerPixel(); | 2052 results->depth = info.GetBitsPerPixel(); |
| 2049 results->depthPerComponent = info.GetBitsPerComponent(); | 2053 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2050 results->isMonochrome = (results->depthPerComponent == 0); | 2054 results->isMonochrome = (results->depthPerComponent == 0); |
| 2051 } | 2055 } |
| 2052 | 2056 |
| 2053 } // namespace content | 2057 } // namespace content |
| OLD | NEW |