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/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 void GpuProcessTransportFactory::AddObserver( | 318 void GpuProcessTransportFactory::AddObserver( |
319 ImageTransportFactoryObserver* observer) { | 319 ImageTransportFactoryObserver* observer) { |
320 observer_list_.AddObserver(observer); | 320 observer_list_.AddObserver(observer); |
321 } | 321 } |
322 | 322 |
323 void GpuProcessTransportFactory::RemoveObserver( | 323 void GpuProcessTransportFactory::RemoveObserver( |
324 ImageTransportFactoryObserver* observer) { | 324 ImageTransportFactoryObserver* observer) { |
325 observer_list_.RemoveObserver(observer); | 325 observer_list_.RemoveObserver(observer); |
326 } | 326 } |
327 | 327 |
| 328 #if defined(OS_MACOSX) |
| 329 void GpuProcessTransportFactory::OnSurfaceDisplayed(int surface_id) { |
| 330 BrowserCompositorOutputSurface* surface = output_surface_map_.Lookup( |
| 331 surface_id); |
| 332 if (surface) |
| 333 surface->OnSurfaceDisplayed(); |
| 334 } |
| 335 #endif |
| 336 |
328 scoped_refptr<cc::ContextProvider> | 337 scoped_refptr<cc::ContextProvider> |
329 GpuProcessTransportFactory::SharedMainThreadContextProvider() { | 338 GpuProcessTransportFactory::SharedMainThreadContextProvider() { |
330 if (shared_main_thread_contexts_.get()) | 339 if (shared_main_thread_contexts_.get()) |
331 return shared_main_thread_contexts_; | 340 return shared_main_thread_contexts_; |
332 | 341 |
333 // In threaded compositing mode, we have to create our own context for the | 342 // In threaded compositing mode, we have to create our own context for the |
334 // main thread since the compositor's context will be bound to the | 343 // main thread since the compositor's context will be bound to the |
335 // compositor thread. When not in threaded mode, we still need a separate | 344 // compositor thread. When not in threaded mode, we still need a separate |
336 // context so that skia and gl_helper don't step on each other. | 345 // context so that skia and gl_helper don't step on each other. |
337 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( | 346 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 432 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
424 observer_list_, | 433 observer_list_, |
425 OnLostResources()); | 434 OnLostResources()); |
426 | 435 |
427 // Kill things that use the shared context before killing the shared context. | 436 // Kill things that use the shared context before killing the shared context. |
428 lost_gl_helper.reset(); | 437 lost_gl_helper.reset(); |
429 lost_shared_main_thread_contexts = NULL; | 438 lost_shared_main_thread_contexts = NULL; |
430 } | 439 } |
431 | 440 |
432 } // namespace content | 441 } // namespace content |
OLD | NEW |