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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 void SurfaceFactory::SubmitCompositorFrame( | 46 void SurfaceFactory::SubmitCompositorFrame( |
47 const LocalSurfaceId& local_surface_id, | 47 const LocalSurfaceId& local_surface_id, |
48 CompositorFrame frame, | 48 CompositorFrame frame, |
49 const DrawCallback& callback, | 49 const DrawCallback& callback, |
50 const WillDrawCallback& will_draw_callback) { | 50 const WillDrawCallback& will_draw_callback) { |
51 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); | 51 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); |
52 DCHECK(local_surface_id.is_valid()); | 52 DCHECK(local_surface_id.is_valid()); |
53 | 53 |
| 54 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info, |
| 55 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { |
| 56 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); |
| 57 } |
| 58 |
54 for (ui::LatencyInfo& latency : frame.metadata.latency_info) { | 59 for (ui::LatencyInfo& latency : frame.metadata.latency_info) { |
55 if (latency.latency_components().size() > 0) { | 60 if (latency.latency_components().size() > 0) { |
56 latency.AddLatencyNumber(ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, | 61 latency.AddLatencyNumber(ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, |
57 0, 0); | 62 0, 0); |
58 } | 63 } |
59 } | 64 } |
60 | 65 |
61 std::unique_ptr<Surface> surface; | 66 std::unique_ptr<Surface> surface; |
62 bool create_new_surface = | 67 bool create_new_surface = |
63 (!current_surface_ || | 68 (!current_surface_ || |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 surface->AddObserver(this); | 146 surface->AddObserver(this); |
142 return surface; | 147 return surface; |
143 } | 148 } |
144 | 149 |
145 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { | 150 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { |
146 surface->RemoveObserver(this); | 151 surface->RemoveObserver(this); |
147 manager_->DestroySurface(std::move(surface)); | 152 manager_->DestroySurface(std::move(surface)); |
148 } | 153 } |
149 | 154 |
150 } // namespace cc | 155 } // namespace cc |
OLD | NEW |