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/compositor/browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/browser_compositor_output_surface.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (!OutputSurface::BindToClient(client)) | 63 if (!OutputSurface::BindToClient(client)) |
64 return false; | 64 return false; |
65 | 65 |
66 output_surface_map_->AddWithID(this, surface_id_); | 66 output_surface_map_->AddWithID(this, surface_id_); |
67 if (reflector_) | 67 if (reflector_) |
68 reflector_->OnSourceSurfaceReady(this); | 68 reflector_->OnSourceSurfaceReady(this); |
69 vsync_manager_->AddObserver(this); | 69 vsync_manager_->AddObserver(this); |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
| 73 void BrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
| 74 // On Mac, delay acknowledging the swap to the output surface client until |
| 75 // it has been drawn. |
| 76 #if !defined(OS_MACOSX) |
| 77 cc::OutputSurface::OnSwapBuffersComplete(); |
| 78 #endif |
| 79 } |
| 80 |
73 void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( | 81 void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( |
74 base::TimeTicks timebase, | 82 base::TimeTicks timebase, |
75 base::TimeDelta interval) { | 83 base::TimeDelta interval) { |
76 DCHECK(CalledOnValidThread()); | 84 DCHECK(CalledOnValidThread()); |
77 DCHECK(HasClient()); | 85 DCHECK(HasClient()); |
78 CommitVSyncParameters(timebase, interval); | 86 CommitVSyncParameters(timebase, interval); |
79 } | 87 } |
80 | 88 |
81 void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( | 89 void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( |
82 base::TimeTicks timebase, | 90 base::TimeTicks timebase, |
83 base::TimeDelta interval) { | 91 base::TimeDelta interval) { |
84 DCHECK(CalledOnValidThread()); | 92 DCHECK(CalledOnValidThread()); |
85 DCHECK(HasClient()); | 93 DCHECK(HasClient()); |
86 vsync_manager_->UpdateVSyncParameters(timebase, interval); | 94 vsync_manager_->UpdateVSyncParameters(timebase, interval); |
87 } | 95 } |
88 | 96 |
89 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { | 97 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { |
90 reflector_ = reflector; | 98 reflector_ = reflector; |
91 } | 99 } |
92 | 100 |
| 101 #if defined(OS_MACOSX) |
| 102 void BrowserCompositorOutputSurface::OnSurfaceDisplayed() { |
| 103 cc::OutputSurface::OnSwapBuffersComplete(); |
| 104 } |
| 105 #endif |
| 106 |
93 } // namespace content | 107 } // namespace content |
OLD | NEW |