| 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 "ui/compositor/test/in_process_context_factory.h" | 5 #include "ui/compositor/test/in_process_context_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // GL surface. | 49 // GL surface. |
| 50 class DirectOutputSurface : public cc::OutputSurface { | 50 class DirectOutputSurface : public cc::OutputSurface { |
| 51 public: | 51 public: |
| 52 DirectOutputSurface(scoped_refptr<InProcessContextProvider> context_provider) | 52 DirectOutputSurface(scoped_refptr<InProcessContextProvider> context_provider) |
| 53 : cc::OutputSurface(std::move(context_provider)), | 53 : cc::OutputSurface(std::move(context_provider)), |
| 54 weak_ptr_factory_(this) {} | 54 weak_ptr_factory_(this) {} |
| 55 | 55 |
| 56 ~DirectOutputSurface() override {} | 56 ~DirectOutputSurface() override {} |
| 57 | 57 |
| 58 // cc::OutputSurface implementation. | 58 // cc::OutputSurface implementation. |
| 59 bool BindToClient(cc::OutputSurfaceClient* client) override { | 59 void BindToClient(cc::OutputSurfaceClient* client) override { |
| 60 return OutputSurface::BindToClient(client); | 60 client_ = client; |
| 61 } | 61 } |
| 62 void EnsureBackbuffer() override {} | 62 void EnsureBackbuffer() override {} |
| 63 void DiscardBackbuffer() override {} | 63 void DiscardBackbuffer() override {} |
| 64 void BindFramebuffer() override { | 64 void BindFramebuffer() override { |
| 65 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); | 65 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); |
| 66 } | 66 } |
| 67 void Reshape(const gfx::Size& size, | 67 void Reshape(const gfx::Size& size, |
| 68 float device_scale_factor, | 68 float device_scale_factor, |
| 69 const gfx::ColorSpace& color_space, | 69 const gfx::ColorSpace& color_space, |
| 70 bool has_alpha) override { | 70 bool has_alpha) override { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 } | 99 } |
| 100 bool IsDisplayedAsOverlayPlane() const override { return false; } | 100 bool IsDisplayedAsOverlayPlane() const override { return false; } |
| 101 unsigned GetOverlayTextureId() const override { return 0; } | 101 unsigned GetOverlayTextureId() const override { return 0; } |
| 102 bool SurfaceIsSuspendForRecycle() const override { return false; } | 102 bool SurfaceIsSuspendForRecycle() const override { return false; } |
| 103 bool HasExternalStencilTest() const override { return false; } | 103 bool HasExternalStencilTest() const override { return false; } |
| 104 void ApplyExternalStencil() override {} | 104 void ApplyExternalStencil() override {} |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 void OnSwapBuffersComplete() { client_->DidReceiveSwapBuffersAck(); } | 107 void OnSwapBuffersComplete() { client_->DidReceiveSwapBuffersAck(); } |
| 108 | 108 |
| 109 cc::OutputSurfaceClient* client_ = nullptr; |
| 109 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | 110 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; |
| 110 | 111 |
| 111 DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); | 112 DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 } // namespace | 115 } // namespace |
| 115 | 116 |
| 116 InProcessContextFactory::InProcessContextFactory( | 117 InProcessContextFactory::InProcessContextFactory( |
| 117 bool context_factory_for_test, | 118 bool context_factory_for_test, |
| 118 cc::SurfaceManager* surface_manager) | 119 cc::SurfaceManager* surface_manager) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 282 |
| 282 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { | 283 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { |
| 283 observer_list_.AddObserver(observer); | 284 observer_list_.AddObserver(observer); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { | 287 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { |
| 287 observer_list_.RemoveObserver(observer); | 288 observer_list_.RemoveObserver(observer); |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace ui | 291 } // namespace ui |
| OLD | NEW |