Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1109)

Side by Side Diff: content/browser/renderer_host/image_transport_factory.cc

Issue 11967033: [CLOSED] In-browser software compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the lack SkCanvas::clear scissoring. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/image_transport_factory.h" 5 #include "content/browser/renderer_host/image_transport_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
16 #include "cc/output_surface.h"
17 #include "cc/output_surface_client.h" 16 #include "cc/output_surface_client.h"
17 #include "cc/output_surface_impl.h"
18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
19 #include "content/browser/gpu/gpu_data_manager_impl.h" 19 #include "content/browser/gpu/gpu_data_manager_impl.h"
20 #include "content/browser/gpu/gpu_process_host.h" 20 #include "content/browser/gpu/gpu_process_host.h"
21 #include "content/browser/gpu/gpu_surface_tracker.h" 21 #include "content/browser/gpu/gpu_surface_tracker.h"
22 #include "content/browser/renderer_host/software_output_device.h"
22 #include "content/common/gpu/client/gl_helper.h" 23 #include "content/common/gpu/client/gl_helper.h"
23 #include "content/common/gpu/client/gpu_channel_host.h" 24 #include "content/common/gpu/client/gpu_channel_host.h"
24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
25 #include "content/common/gpu/gpu_messages.h" 26 #include "content/common/gpu/gpu_messages.h"
26 #include "content/common/gpu/gpu_process_launch_causes.h" 27 #include "content/common/gpu/gpu_process_launch_causes.h"
27 #include "content/common/webkitplatformsupport_impl.h" 28 #include "content/common/webkitplatformsupport_impl.h"
28 #include "content/public/common/content_switches.h" 29 #include "content/public/common/content_switches.h"
29 #include "gpu/GLES2/gl2extchromium.h" 30 #include "gpu/GLES2/gl2extchromium.h"
30 #include "gpu/ipc/command_buffer_proxy.h" 31 #include "gpu/ipc/command_buffer_proxy.h"
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
32 #include "third_party/khronos/GLES2/gl2.h" 33 #include "third_party/khronos/GLES2/gl2.h"
33 #include "third_party/khronos/GLES2/gl2ext.h" 34 #include "third_party/khronos/GLES2/gl2ext.h"
34 #include "ui/compositor/compositor.h" 35 #include "ui/compositor/compositor.h"
35 #include "ui/compositor/compositor_setup.h" 36 #include "ui/compositor/compositor_setup.h"
37 #include "ui/compositor/compositor_switches.h"
36 #include "ui/compositor/test_web_graphics_context_3d.h" 38 #include "ui/compositor/test_web_graphics_context_3d.h"
37 #include "ui/gfx/native_widget_types.h" 39 #include "ui/gfx/native_widget_types.h"
38 #include "ui/gfx/size.h" 40 #include "ui/gfx/size.h"
39 41
40 #if defined(OS_WIN) 42 #if defined(OS_WIN)
41 #include "ui/surface/accelerated_surface_win.h" 43 #include "ui/surface/accelerated_surface_win.h"
42 #endif 44 #endif
43 45
44 namespace content { 46 namespace content {
45 namespace { 47 namespace {
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // Note: previous line destroyed this. Don't access members from now on. 608 // Note: previous line destroyed this. Don't access members from now on.
607 } 609 }
608 610
609 WebKit::WebGraphicsContext3D* CreateTestContext() { 611 WebKit::WebGraphicsContext3D* CreateTestContext() {
610 ui::TestWebGraphicsContext3D* test_context = 612 ui::TestWebGraphicsContext3D* test_context =
611 new ui::TestWebGraphicsContext3D(); 613 new ui::TestWebGraphicsContext3D();
612 test_context->Initialize(); 614 test_context->Initialize();
613 return test_context; 615 return test_context;
614 } 616 }
615 617
618 class SoftwareTransportFactory : public DefaultTransportFactory {
619 public:
620 cc::OutputSurface* CreateOutputSurface(ui::Compositor* compositor) {
621 scoped_ptr<SoftwareOutputDevice> software_device(
622 new SoftwareOutputDevice(compositor));
623 return new cc::OutputSurfaceImpl(
624 software_device.PassAs<cc::SoftwareOutputDevice>());
625 }
626 };
627
616 } // anonymous namespace 628 } // anonymous namespace
617 629
618 // static 630 // static
619 void ImageTransportFactory::Initialize() { 631 void ImageTransportFactory::Initialize() {
620 CommandLine* command_line = CommandLine::ForCurrentProcess(); 632 CommandLine* command_line = CommandLine::ForCurrentProcess();
621 if (command_line->HasSwitch(switches::kTestCompositor)) { 633 if (command_line->HasSwitch(switches::kTestCompositor)) {
622 ui::SetupTestCompositor(); 634 ui::SetupTestCompositor();
623 } 635 }
624 if (ui::IsTestCompositorEnabled()) { 636 if (ui::IsTestCompositorEnabled()) {
625 g_factory = new DefaultTransportFactory(); 637 g_factory = new DefaultTransportFactory;
626 WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest( 638 WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest(
627 CreateTestContext); 639 CreateTestContext);
640 } else if (command_line->HasSwitch(switches::kUIEnableSoftwareCompositing)) {
641 g_factory = new SoftwareTransportFactory;
628 } else { 642 } else {
629 g_factory = new GpuProcessTransportFactory(); 643 g_factory = new GpuProcessTransportFactory;
630 } 644 }
631 ui::ContextFactory::SetInstance(g_factory->AsContextFactory()); 645 ui::ContextFactory::SetInstance(g_factory->AsContextFactory());
632 } 646 }
633 647
634 // static 648 // static
635 void ImageTransportFactory::Terminate() { 649 void ImageTransportFactory::Terminate() {
636 ui::ContextFactory::SetInstance(NULL); 650 ui::ContextFactory::SetInstance(NULL);
637 delete g_factory; 651 delete g_factory;
638 g_factory = NULL; 652 g_factory = NULL;
639 } 653 }
640 654
641 // static 655 // static
642 ImageTransportFactory* ImageTransportFactory::GetInstance() { 656 ImageTransportFactory* ImageTransportFactory::GetInstance() {
643 return g_factory; 657 return g_factory;
644 } 658 }
645 659
646 } // namespace content 660 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_win.cc ('k') | content/browser/renderer_host/software_output_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698