| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() { | 71 void BrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
| 72 #if defined(OS_MACOSX) |
| 72 // On Mac, delay acknowledging the swap to the output surface client until | 73 // On Mac, delay acknowledging the swap to the output surface client until |
| 73 // it has been drawn. | 74 // it has been drawn. |
| 74 #if !defined(OS_MACOSX) | 75 NOTREACHED(); |
| 76 #endif |
| 75 cc::OutputSurface::OnSwapBuffersComplete(); | 77 cc::OutputSurface::OnSwapBuffersComplete(); |
| 76 #endif | |
| 77 } | 78 } |
| 78 | 79 |
| 79 void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( | 80 void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( |
| 80 base::TimeTicks timebase, | 81 base::TimeTicks timebase, |
| 81 base::TimeDelta interval) { | 82 base::TimeDelta interval) { |
| 82 DCHECK(CalledOnValidThread()); | 83 DCHECK(CalledOnValidThread()); |
| 83 DCHECK(HasClient()); | 84 DCHECK(HasClient()); |
| 84 CommitVSyncParameters(timebase, interval); | 85 CommitVSyncParameters(timebase, interval); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( | 88 void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( |
| 88 base::TimeTicks timebase, | 89 base::TimeTicks timebase, |
| 89 base::TimeDelta interval) { | 90 base::TimeDelta interval) { |
| 90 DCHECK(CalledOnValidThread()); | 91 DCHECK(CalledOnValidThread()); |
| 91 DCHECK(HasClient()); | 92 DCHECK(HasClient()); |
| 92 vsync_manager_->UpdateVSyncParameters(timebase, interval); | 93 vsync_manager_->UpdateVSyncParameters(timebase, interval); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { | 96 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { |
| 96 reflector_ = reflector; | 97 reflector_ = reflector; |
| 97 } | 98 } |
| 98 | 99 |
| 99 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
| 100 void BrowserCompositorOutputSurface::OnSurfaceDisplayed() { | 101 void BrowserCompositorOutputSurface::OnSurfaceDisplayed() { |
| 101 cc::OutputSurface::OnSwapBuffersComplete(); | 102 cc::OutputSurface::OnSwapBuffersComplete(); |
| 102 } | 103 } |
| 103 #endif | 104 #endif |
| 104 | 105 |
| 105 } // namespace content | 106 } // namespace content |
| OLD | NEW |