| 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/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
| 16 #include "cc/base/switches.h" | 16 #include "cc/base/switches.h" |
| 17 #include "cc/output/compositor_frame.h" | 17 #include "cc/output/compositor_frame.h" |
| 18 #include "cc/output/copy_output_request.h" | 18 #include "cc/output/copy_output_request.h" |
| 19 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
| 20 #include "cc/resources/texture_mailbox.h" | 20 #include "cc/resources/texture_mailbox.h" |
| 21 #include "cc/surfaces/local_surface_id_allocator.h" |
| 21 #include "cc/surfaces/surface.h" | 22 #include "cc/surfaces/surface.h" |
| 22 #include "cc/surfaces/surface_factory.h" | 23 #include "cc/surfaces/surface_factory.h" |
| 23 #include "cc/surfaces/surface_hittest.h" | 24 #include "cc/surfaces/surface_hittest.h" |
| 24 #include "cc/surfaces/surface_manager.h" | 25 #include "cc/surfaces/surface_manager.h" |
| 25 #include "components/display_compositor/gl_helper.h" | 26 #include "components/display_compositor/gl_helper.h" |
| 26 #include "content/browser/compositor/surface_utils.h" | 27 #include "content/browser/compositor/surface_utils.h" |
| 27 #include "content/browser/gpu/compositor_util.h" | 28 #include "content/browser/gpu/compositor_util.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" |
| 29 #include "content/browser/renderer_host/resize_lock.h" | 30 #include "content/browser/renderer_host/resize_lock.h" |
| 30 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 49 tick_clock_(new base::DefaultTickClock()), | 50 tick_clock_(new base::DefaultTickClock()), |
| 50 last_compositor_frame_sink_id_(0), | 51 last_compositor_frame_sink_id_(0), |
| 51 pending_delegated_ack_count_(0), | 52 pending_delegated_ack_count_(0), |
| 52 skipped_frames_(false), | 53 skipped_frames_(false), |
| 53 background_color_(SK_ColorRED), | 54 background_color_(SK_ColorRED), |
| 54 current_scale_factor_(1.f), | 55 current_scale_factor_(1.f), |
| 55 can_lock_compositor_(YES_CAN_LOCK), | 56 can_lock_compositor_(YES_CAN_LOCK), |
| 56 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { | 57 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { |
| 57 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 58 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 58 factory->GetContextFactory()->AddObserver(this); | 59 factory->GetContextFactory()->AddObserver(this); |
| 59 id_allocator_.reset(new cc::SurfaceIdAllocator()); | 60 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); |
| 60 factory->GetContextFactoryPrivate()->GetSurfaceManager()->RegisterFrameSinkId( | 61 factory->GetContextFactoryPrivate()->GetSurfaceManager()->RegisterFrameSinkId( |
| 61 frame_sink_id_); | 62 frame_sink_id_); |
| 62 factory->GetContextFactoryPrivate() | 63 factory->GetContextFactoryPrivate() |
| 63 ->GetSurfaceManager() | 64 ->GetSurfaceManager() |
| 64 ->RegisterSurfaceFactoryClient(frame_sink_id_, this); | 65 ->RegisterSurfaceFactoryClient(frame_sink_id_, this); |
| 65 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( | 66 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 66 frame_sink_id_, factory->GetContextFactoryPrivate()->GetSurfaceManager(), | 67 frame_sink_id_, factory->GetContextFactoryPrivate()->GetSurfaceManager(), |
| 67 this); | 68 this); |
| 68 } | 69 } |
| 69 | 70 |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 std::move(request)); | 869 std::move(request)); |
| 869 } | 870 } |
| 870 } | 871 } |
| 871 | 872 |
| 872 void DelegatedFrameHost::UnlockResources() { | 873 void DelegatedFrameHost::UnlockResources() { |
| 873 DCHECK(local_surface_id_.is_valid()); | 874 DCHECK(local_surface_id_.is_valid()); |
| 874 delegated_frame_evictor_->UnlockFrame(); | 875 delegated_frame_evictor_->UnlockFrame(); |
| 875 } | 876 } |
| 876 | 877 |
| 877 } // namespace content | 878 } // namespace content |
| OLD | NEW |