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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "gpu/GLES2/gl2extchromium.h" | 48 #include "gpu/GLES2/gl2extchromium.h" |
49 #include "gpu/command_buffer/client/gles2_interface.h" | 49 #include "gpu/command_buffer/client/gles2_interface.h" |
50 #include "gpu/command_buffer/common/mailbox.h" | 50 #include "gpu/command_buffer/common/mailbox.h" |
51 #include "third_party/khronos/GLES2/gl2.h" | 51 #include "third_party/khronos/GLES2/gl2.h" |
52 #include "ui/compositor/compositor.h" | 52 #include "ui/compositor/compositor.h" |
53 #include "ui/compositor/compositor_constants.h" | 53 #include "ui/compositor/compositor_constants.h" |
54 #include "ui/compositor/compositor_switches.h" | 54 #include "ui/compositor/compositor_switches.h" |
55 #include "ui/compositor/layer.h" | 55 #include "ui/compositor/layer.h" |
56 #include "ui/gfx/geometry/size.h" | 56 #include "ui/gfx/geometry/size.h" |
57 #include "ui/gfx/native_widget_types.h" | 57 #include "ui/gfx/native_widget_types.h" |
| 58 #include "url/gurl.h" |
58 | 59 |
59 #if defined(MOJO_RUNNER_CLIENT) | 60 #if defined(MOJO_RUNNER_CLIENT) |
60 #include "content/common/mojo/mojo_shell_connection_impl.h" | 61 #include "content/common/mojo/mojo_shell_connection_impl.h" |
61 #endif | 62 #endif |
62 | 63 |
63 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
64 #include "content/browser/compositor/software_output_device_win.h" | 65 #include "content/browser/compositor/software_output_device_win.h" |
65 #elif defined(USE_OZONE) | 66 #elif defined(USE_OZONE) |
66 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_ozone.h" | 67 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_ozone.h" |
67 #include "content/browser/compositor/software_output_device_ozone.h" | 68 #include "content/browser/compositor/software_output_device_ozone.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 attrs.shareResources = true; | 605 attrs.shareResources = true; |
605 attrs.depth = false; | 606 attrs.depth = false; |
606 attrs.stencil = false; | 607 attrs.stencil = false; |
607 attrs.antialias = false; | 608 attrs.antialias = false; |
608 attrs.noAutomaticFlushes = true; | 609 attrs.noAutomaticFlushes = true; |
609 bool lose_context_when_out_of_memory = true; | 610 bool lose_context_when_out_of_memory = true; |
610 if (!gpu_channel_host.get()) { | 611 if (!gpu_channel_host.get()) { |
611 LOG(ERROR) << "Failed to establish GPU channel."; | 612 LOG(ERROR) << "Failed to establish GPU channel."; |
612 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 613 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
613 } | 614 } |
614 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); | |
615 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 615 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
616 new WebGraphicsContext3DCommandBufferImpl( | 616 new WebGraphicsContext3DCommandBufferImpl( |
617 surface_id, | 617 surface_id, |
618 url, | 618 "chrome://gpu/GpuProcessTransportFactory::CreateContextCommon", |
619 gpu_channel_host.get(), | 619 gpu_channel_host.get(), attrs, lose_context_when_out_of_memory, |
620 attrs, | 620 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); |
621 lose_context_when_out_of_memory, | |
622 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | |
623 NULL)); | |
624 return context; | 621 return context; |
625 } | 622 } |
626 | 623 |
627 void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() { | 624 void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() { |
628 base::ThreadTaskRunnerHandle::Get()->PostTask( | 625 base::ThreadTaskRunnerHandle::Get()->PostTask( |
629 FROM_HERE, | 626 FROM_HERE, |
630 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext, | 627 base::Bind(&GpuProcessTransportFactory::OnLostMainThreadSharedContext, |
631 callback_factory_.GetWeakPtr())); | 628 callback_factory_.GetWeakPtr())); |
632 } | 629 } |
633 | 630 |
(...skipping 13 matching lines...) Expand all Loading... |
647 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 644 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
648 observer_list_, | 645 observer_list_, |
649 OnLostResources()); | 646 OnLostResources()); |
650 | 647 |
651 // Kill things that use the shared context before killing the shared context. | 648 // Kill things that use the shared context before killing the shared context. |
652 lost_gl_helper.reset(); | 649 lost_gl_helper.reset(); |
653 lost_shared_main_thread_contexts = NULL; | 650 lost_shared_main_thread_contexts = NULL; |
654 } | 651 } |
655 | 652 |
656 } // namespace content | 653 } // namespace content |
OLD | NEW |