| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/test/scoped_task_scheduler.h" | 16 #include "base/test/scoped_task_scheduler.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "cc/surfaces/compositor_frame_sink_support.h" | 18 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 19 #include "cc/surfaces/surface.h" | 19 #include "cc/surfaces/surface.h" |
| 20 #include "cc/surfaces/surface_factory.h" | |
| 21 #include "cc/surfaces/surface_manager.h" | 20 #include "cc/surfaces/surface_manager.h" |
| 22 #include "cc/surfaces/surface_sequence.h" | 21 #include "cc/surfaces/surface_sequence.h" |
| 23 #include "cc/test/begin_frame_args_test.h" | 22 #include "cc/test/begin_frame_args_test.h" |
| 24 #include "cc/test/fake_external_begin_frame_source.h" | 23 #include "cc/test/fake_external_begin_frame_source.h" |
| 25 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 24 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
| 26 #include "content/browser/frame_host/cross_process_frame_connector.h" | 25 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 27 #include "content/browser/gpu/compositor_util.h" | 26 #include "content/browser/gpu/compositor_util.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 27 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_impl.h" | 28 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 30 #include "content/common/view_messages.h" | 29 #include "content/common/view_messages.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 gfx::Size view_size(100, 100); | 235 gfx::Size view_size(100, 100); |
| 237 gfx::Rect view_rect(view_size); | 236 gfx::Rect view_rect(view_size); |
| 238 float scale_factor = 1.f; | 237 float scale_factor = 1.f; |
| 239 | 238 |
| 240 view_->SetSize(view_size); | 239 view_->SetSize(view_size); |
| 241 view_->Show(); | 240 view_->Show(); |
| 242 | 241 |
| 243 // Replace BeginFrameSource so that we can observe acknowledgments. | 242 // Replace BeginFrameSource so that we can observe acknowledgments. |
| 244 cc::FakeExternalBeginFrameSource source(0.f, false); | 243 cc::FakeExternalBeginFrameSource source(0.f, false); |
| 245 uint32_t source_id = source.source_id(); | 244 uint32_t source_id = source.source_id(); |
| 246 static_cast<cc::SurfaceFactoryClient*>(view_->support_.get()) | 245 view_->support_->SetBeginFrameSource(&source); |
| 247 ->SetBeginFrameSource(&source); | |
| 248 view_->SetNeedsBeginFrames(true); | 246 view_->SetNeedsBeginFrames(true); |
| 249 | 247 |
| 250 { | 248 { |
| 251 cc::BeginFrameArgs args = | 249 cc::BeginFrameArgs args = |
| 252 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 5u); | 250 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 5u); |
| 253 source.TestOnBeginFrame(args); | 251 source.TestOnBeginFrame(args); |
| 254 | 252 |
| 255 // Ack from CompositorFrame is forwarded. | 253 // Ack from CompositorFrame is forwarded. |
| 256 cc::BeginFrameAck ack(source_id, 5, 4, true); | 254 cc::BeginFrameAck ack(source_id, 5, 4, true); |
| 257 cc::CompositorFrame frame = | 255 cc::CompositorFrame frame = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 269 // Explicit ack through OnBeginFrameDidNotSwap is forwarded. | 267 // Explicit ack through OnBeginFrameDidNotSwap is forwarded. |
| 270 cc::BeginFrameAck ack(source_id, 6, 4, false); | 268 cc::BeginFrameAck ack(source_id, 6, 4, false); |
| 271 view_->OnBeginFrameDidNotSwap(ack); | 269 view_->OnBeginFrameDidNotSwap(ack); |
| 272 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); | 270 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); |
| 273 } | 271 } |
| 274 | 272 |
| 275 view_->SetNeedsBeginFrames(false); | 273 view_->SetNeedsBeginFrames(false); |
| 276 } | 274 } |
| 277 | 275 |
| 278 } // namespace content | 276 } // namespace content |
| OLD | NEW |