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