| 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 "cc/surfaces/surface_factory.h" | 5 #include "cc/surfaces/surface_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return; | 40 return; |
| 41 Destroy(std::move(current_surface_)); | 41 Destroy(std::move(current_surface_)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void SurfaceFactory::SubmitCompositorFrame( | 44 void SurfaceFactory::SubmitCompositorFrame( |
| 45 const LocalSurfaceId& local_surface_id, | 45 const LocalSurfaceId& local_surface_id, |
| 46 CompositorFrame frame, | 46 CompositorFrame frame, |
| 47 const DrawCallback& callback) { | 47 const DrawCallback& callback) { |
| 48 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); | 48 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); |
| 49 DCHECK(local_surface_id.is_valid()); | 49 DCHECK(local_surface_id.is_valid()); |
| 50 |
| 51 for (ui::LatencyInfo& latency : frame.metadata.latency_info) { |
| 52 // TODO: These latencies need to be saved somehow. |
| 53 // TODO: Rename INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT |
| 54 // TODO: Remove similar code in RWHLatencyTracker? |
| 55 // TODO: Better if? Maybe just check if latency_info has ANY components? |
| 56 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, nullptr
) || |
| 57 latency.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, nullptr)
|| |
| 58 latency.FindLatency(ui::TAB_SHOW_COMPONENT, nullptr)) { |
| 59 latency.AddLatencyNumber( |
| 60 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0); |
| 61 } |
| 62 } |
| 63 |
| 50 std::unique_ptr<Surface> surface; | 64 std::unique_ptr<Surface> surface; |
| 51 bool create_new_surface = | 65 bool create_new_surface = |
| 52 (!current_surface_ || | 66 (!current_surface_ || |
| 53 local_surface_id != current_surface_->surface_id().local_surface_id()); | 67 local_surface_id != current_surface_->surface_id().local_surface_id()); |
| 54 if (!create_new_surface) { | 68 if (!create_new_surface) { |
| 55 surface = std::move(current_surface_); | 69 surface = std::move(current_surface_); |
| 56 } else { | 70 } else { |
| 57 surface = Create(local_surface_id); | 71 surface = Create(local_surface_id); |
| 58 } | 72 } |
| 59 surface->QueueFrame(std::move(frame), callback); | 73 surface->QueueFrame(std::move(frame), callback); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 surface->AddObserver(this); | 162 surface->AddObserver(this); |
| 149 return surface; | 163 return surface; |
| 150 } | 164 } |
| 151 | 165 |
| 152 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { | 166 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { |
| 153 surface->RemoveObserver(this); | 167 surface->RemoveObserver(this); |
| 154 manager_->DestroySurface(std::move(surface)); | 168 manager_->DestroySurface(std::move(surface)); |
| 155 } | 169 } |
| 156 | 170 |
| 157 } // namespace cc | 171 } // namespace cc |
| OLD | NEW |