Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2693423005: DelegatedFrameHost should use CompositorFrameSinkSupport (Closed)
Patch Set: c Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 const cc::LocalSurfaceId& GetLocalSurfaceId() const { 421 const cc::LocalSurfaceId& GetLocalSurfaceId() const {
422 return GetDelegatedFrameHost()->LocalSurfaceIdForTesting(); 422 return GetDelegatedFrameHost()->LocalSurfaceIdForTesting();
423 } 423 }
424 424
425 bool HasFrameData() const { return GetLocalSurfaceId().is_valid(); } 425 bool HasFrameData() const { return GetLocalSurfaceId().is_valid(); }
426 426
427 bool released_front_lock_active() const { 427 bool released_front_lock_active() const {
428 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting(); 428 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting();
429 } 429 }
430 430
431 void ReturnResources(const cc::ReturnedResourceArray& resources) { 431 void ReclaimResources(const cc::ReturnedResourceArray& resources) {
432 GetDelegatedFrameHost()->ReturnResources(resources); 432 GetDelegatedFrameHost()->ReclaimResources(resources);
433 } 433 }
434 434
435 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); } 435 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); }
436 436
437 const ui::MotionEventAura& pointer_state_for_test() { 437 const ui::MotionEventAura& pointer_state_for_test() {
438 return event_handler()->pointer_state(); 438 return event_handler()->pointer_state();
439 } 439 }
440 440
441 // In this unit test, |window_| is directly added to the root and is 441 // In this unit test, |window_| is directly added to the root and is
442 // toplevel. 442 // toplevel.
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 gfx::Rect view_rect(view_size); 1760 gfx::Rect view_rect(view_size);
1761 1761
1762 view_->InitAsChild(nullptr); 1762 view_->InitAsChild(nullptr);
1763 aura::client::ParentWindowWithContext( 1763 aura::client::ParentWindowWithContext(
1764 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1764 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1765 gfx::Rect()); 1765 gfx::Rect());
1766 view_->SetSize(view_size); 1766 view_->SetSize(view_size);
1767 view_->Show(); 1767 view_->Show();
1768 sink_->ClearMessages(); 1768 sink_->ClearMessages();
1769 1769
1770 // Accumulate some returned resources. This should not trigger an IPC. 1770 // Accumulate some returned resources. This should trigger an IPC.
1771 cc::ReturnedResourceArray resources; 1771 cc::ReturnedResourceArray resources;
1772 cc::ReturnedResource resource; 1772 cc::ReturnedResource resource;
1773 resource.id = 1; 1773 resource.id = 1;
1774 resources.push_back(resource); 1774 resources.push_back(resource);
1775 view_->ReturnResources(resources); 1775 view_->ReclaimResources(resources);
1776 EXPECT_EQ(1u, sink_->message_count()); 1776 EXPECT_EQ(1u, sink_->message_count());
1777 { 1777 {
1778 const IPC::Message* msg = sink_->GetMessageAt(0); 1778 const IPC::Message* msg = sink_->GetMessageAt(0);
1779 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); 1779 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type());
1780 ViewMsg_ReclaimCompositorResources::Param params; 1780 ViewMsg_ReclaimCompositorResources::Param params;
1781 ViewMsg_ReclaimCompositorResources::Read(msg, &params); 1781 ViewMsg_ReclaimCompositorResources::Read(msg, &params);
1782 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id 1782 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id
1783 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack 1783 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack
1784 } 1784 }
1785 } 1785 }
(...skipping 11 matching lines...) Expand all
1797 gfx::Rect view_rect(view_size); 1797 gfx::Rect view_rect(view_size);
1798 1798
1799 view_->InitAsChild(nullptr); 1799 view_->InitAsChild(nullptr);
1800 aura::client::ParentWindowWithContext( 1800 aura::client::ParentWindowWithContext(
1801 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1801 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1802 gfx::Rect()); 1802 gfx::Rect());
1803 view_->SetSize(view_size); 1803 view_->SetSize(view_size);
1804 view_->Show(); 1804 view_->Show();
1805 sink_->ClearMessages(); 1805 sink_->ClearMessages();
1806 1806
1807 // Submit a frame with resources.
1808 cc::CompositorFrame frame = MakeDelegatedFrame(1.f, view_size, view_rect);
1809 cc::TransferableResource resource;
1810 resource.id = 1;
1811 frame.resource_list.push_back(resource);
Fady Samuel 2017/02/24 01:20:20 This is dead code?
Saman Sami 2017/02/24 21:56:35 Fixed
1807 view_->OnSwapCompositorFrame(0, 1812 view_->OnSwapCompositorFrame(0,
1808 MakeDelegatedFrame(1.f, view_size, view_rect)); 1813 MakeDelegatedFrame(1.f, view_size, view_rect));
1809
1810 // Accumulate some returned resources. This should not trigger an IPC.
1811 cc::ReturnedResourceArray resources;
1812 cc::ReturnedResource resource;
1813 resource.id = 1;
1814 resources.push_back(resource);
1815 view_->ReturnResources(resources);
1816 EXPECT_EQ(0u, sink_->message_count()); 1814 EXPECT_EQ(0u, sink_->message_count());
1817 1815
1818 // Swap another CompositorFrame but this time from another 1816 // Swap another CompositorFrame but this time from another
1819 // compositor_frame_sink_id. The resources held by DelegatedFrameHost are old 1817 // compositor_frame_sink_id. The resources for the previous frame are old and
1820 // and should not be returned. 1818 // should not be returned.
1821 view_->OnSwapCompositorFrame(1, 1819 view_->OnSwapCompositorFrame(1,
1822 MakeDelegatedFrame(1.f, view_size, view_rect)); 1820 MakeDelegatedFrame(1.f, view_size, view_rect));
1823 EXPECT_EQ(0u, sink_->message_count()); 1821 EXPECT_EQ(0u, sink_->message_count());
1824 1822
1825 // Report that the surface is drawn to trigger an ACK. 1823 // Report that the surface is drawn to trigger an ACK.
1826 cc::Surface* surface = manager->GetSurfaceForId(view_->surface_id()); 1824 cc::Surface* surface = manager->GetSurfaceForId(view_->surface_id());
1827 EXPECT_TRUE(surface); 1825 EXPECT_TRUE(surface);
1828 surface->RunDrawCallbacks(); 1826 surface->RunDrawCallbacks();
1829 EXPECT_EQ(1u, sink_->message_count()); 1827 EXPECT_EQ(1u, sink_->message_count());
1830 { 1828 {
(...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after
4719 // There is no composition in the beginning. 4717 // There is no composition in the beginning.
4720 EXPECT_FALSE(has_composition_text()); 4718 EXPECT_FALSE(has_composition_text());
4721 SetHasCompositionTextToTrue(); 4719 SetHasCompositionTextToTrue();
4722 view->ImeCancelComposition(); 4720 view->ImeCancelComposition();
4723 // The composition must have been canceled. 4721 // The composition must have been canceled.
4724 EXPECT_FALSE(has_composition_text()); 4722 EXPECT_FALSE(has_composition_text());
4725 } 4723 }
4726 } 4724 }
4727 4725
4728 } // namespace content 4726 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698