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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); | 834 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); |
| 835 } | 835 } |
| 836 | 836 |
| 837 scoped_ptr<cc::CompositorFrame> MakeGLFrame(float scale_factor, | 837 scoped_ptr<cc::CompositorFrame> MakeGLFrame(float scale_factor, |
| 838 gfx::Size size, | 838 gfx::Size size, |
| 839 gfx::Rect damage) { | 839 gfx::Rect damage) { |
| 840 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 840 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 841 frame->metadata.device_scale_factor = scale_factor; | 841 frame->metadata.device_scale_factor = scale_factor; |
| 842 frame->gl_frame_data.reset(new cc::GLFrameData); | 842 frame->gl_frame_data.reset(new cc::GLFrameData); |
| 843 frame->gl_frame_data->sync_point = 1; | 843 frame->gl_frame_data->sync_point = 1; |
| 844 memset(frame->gl_frame_data->mailbox.name, '1', 64); | 844 memset(frame->gl_frame_data->mailbox.name, |
| 845 '1', | |
| 846 sizeof(frame->gl_frame_data->mailbox.name)); | |
|
danakj
2014/02/13 17:59:25
sizeof(mailbox.name) here again
| |
| 845 frame->gl_frame_data->size = size; | 847 frame->gl_frame_data->size = size; |
| 846 frame->gl_frame_data->sub_buffer_rect = damage; | 848 frame->gl_frame_data->sub_buffer_rect = damage; |
| 847 return frame.Pass(); | 849 return frame.Pass(); |
| 848 } | 850 } |
| 849 | 851 |
| 850 scoped_ptr<cc::CompositorFrame> MakeSoftwareFrame(float scale_factor, | 852 scoped_ptr<cc::CompositorFrame> MakeSoftwareFrame(float scale_factor, |
| 851 gfx::Size size, | 853 gfx::Size size, |
| 852 gfx::Rect damage) { | 854 gfx::Rect damage) { |
| 853 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 855 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 854 frame->metadata.device_scale_factor = scale_factor; | 856 frame->metadata.device_scale_factor = scale_factor; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 view_->SetSize(view_size); | 944 view_->SetSize(view_size); |
| 943 view_->WasShown(); | 945 view_->WasShown(); |
| 944 | 946 |
| 945 MockWindowObserver observer; | 947 MockWindowObserver observer; |
| 946 view_->window_->AddObserver(&observer); | 948 view_->window_->AddObserver(&observer); |
| 947 | 949 |
| 948 // Swap a frame through the GPU path. | 950 // Swap a frame through the GPU path. |
| 949 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 951 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
| 950 params.surface_id = widget_host_->surface_id(); | 952 params.surface_id = widget_host_->surface_id(); |
| 951 params.route_id = widget_host_->GetRoutingID(); | 953 params.route_id = widget_host_->GetRoutingID(); |
| 952 params.mailbox_name = std::string(64, '1'); | 954 memset(params.mailbox.name, '1', sizeof(params.mailbox.name)); |
| 953 params.size = view_size; | 955 params.size = view_size; |
| 954 params.scale_factor = 1.f; | 956 params.scale_factor = 1.f; |
| 955 | 957 |
| 956 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); | 958 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); |
| 957 view_->AcceleratedSurfaceBuffersSwapped(params, 0); | 959 view_->AcceleratedSurfaceBuffersSwapped(params, 0); |
| 958 testing::Mock::VerifyAndClearExpectations(&observer); | 960 testing::Mock::VerifyAndClearExpectations(&observer); |
| 959 | 961 |
| 960 // DSF = 2 | 962 // DSF = 2 |
| 961 params.size = gfx::Size(200, 200); | 963 params.size = gfx::Size(200, 200); |
| 962 params.scale_factor = 2.f; | 964 params.scale_factor = 2.f; |
| 963 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); | 965 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); |
| 964 view_->AcceleratedSurfaceBuffersSwapped(params, 0); | 966 view_->AcceleratedSurfaceBuffersSwapped(params, 0); |
| 965 testing::Mock::VerifyAndClearExpectations(&observer); | 967 testing::Mock::VerifyAndClearExpectations(&observer); |
| 966 | 968 |
| 967 // Partial frames though GPU path | 969 // Partial frames though GPU path |
| 968 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params post_params; | 970 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params post_params; |
| 969 post_params.surface_id = widget_host_->surface_id(); | 971 post_params.surface_id = widget_host_->surface_id(); |
| 970 post_params.route_id = widget_host_->GetRoutingID(); | 972 post_params.route_id = widget_host_->GetRoutingID(); |
| 971 post_params.mailbox_name = std::string(64, '1'); | 973 memset(post_params.mailbox.name, '1', sizeof(post_params.mailbox.name)); |
| 972 post_params.surface_size = gfx::Size(200, 200); | 974 post_params.surface_size = gfx::Size(200, 200); |
| 973 post_params.surface_scale_factor = 2.f; | 975 post_params.surface_scale_factor = 2.f; |
| 974 post_params.x = 40; | 976 post_params.x = 40; |
| 975 post_params.y = 40; | 977 post_params.y = 40; |
| 976 post_params.width = 80; | 978 post_params.width = 80; |
| 977 post_params.height = 80; | 979 post_params.height = 80; |
| 978 // rect from params is upside down, and is inflated in RWHVA, just because. | 980 // rect from params is upside down, and is inflated in RWHVA, just because. |
| 979 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, | 981 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, |
| 980 gfx::Rect(19, 39, 42, 42))); | 982 gfx::Rect(19, 39, 42, 42))); |
| 981 view_->AcceleratedSurfacePostSubBuffer(post_params, 0); | 983 view_->AcceleratedSurfacePostSubBuffer(post_params, 0); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 | 1415 |
| 1414 // Because the copy request callback may be holding state within it, that | 1416 // Because the copy request callback may be holding state within it, that |
| 1415 // state must handle the RWHVA and ImageTransportFactory going away before the | 1417 // state must handle the RWHVA and ImageTransportFactory going away before the |
| 1416 // callback is called. This test passes if it does not crash as a result of | 1418 // callback is called. This test passes if it does not crash as a result of |
| 1417 // these things being destroyed. | 1419 // these things being destroyed. |
| 1418 EXPECT_EQ(2, callback_count_); | 1420 EXPECT_EQ(2, callback_count_); |
| 1419 EXPECT_FALSE(result_); | 1421 EXPECT_FALSE(result_); |
| 1420 } | 1422 } |
| 1421 | 1423 |
| 1422 } // namespace content | 1424 } // namespace content |
| OLD | NEW |