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 if (latency.latency_components().size() > 0) { |
| 53 latency.AddLatencyNumber(ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, |
| 54 0, 0); |
| 55 } |
| 56 } |
| 57 |
50 std::unique_ptr<Surface> surface; | 58 std::unique_ptr<Surface> surface; |
51 bool create_new_surface = | 59 bool create_new_surface = |
52 (!current_surface_ || | 60 (!current_surface_ || |
53 local_surface_id != current_surface_->surface_id().local_surface_id()); | 61 local_surface_id != current_surface_->surface_id().local_surface_id()); |
54 if (!create_new_surface) { | 62 if (!create_new_surface) { |
55 surface = std::move(current_surface_); | 63 surface = std::move(current_surface_); |
56 } else { | 64 } else { |
57 surface = Create(local_surface_id); | 65 surface = Create(local_surface_id); |
58 } | 66 } |
59 surface->QueueFrame(std::move(frame), callback); | 67 surface->QueueFrame(std::move(frame), callback); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 surface->AddObserver(this); | 156 surface->AddObserver(this); |
149 return surface; | 157 return surface; |
150 } | 158 } |
151 | 159 |
152 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { | 160 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { |
153 surface->RemoveObserver(this); | 161 surface->RemoveObserver(this); |
154 manager_->DestroySurface(std::move(surface)); | 162 manager_->DestroySurface(std::move(surface)); |
155 } | 163 } |
156 | 164 |
157 } // namespace cc | 165 } // namespace cc |
OLD | NEW |