| OLD | NEW |
| 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/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 17 #include "cc/output/output_surface.h" | 17 #include "cc/output/output_surface.h" |
| 18 #include "cc/output/output_surface_client.h" | 18 #include "cc/output/output_surface_client.h" |
| 19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 20 #include "content/browser/gpu/gpu_data_manager_impl.h" | 20 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 21 #include "content/browser/gpu/gpu_process_host.h" | 21 #include "content/browser/gpu/gpu_process_host.h" |
| 22 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 22 #include "content/browser/gpu/gpu_surface_tracker.h" | 23 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 23 #include "content/common/gpu/client/context_provider_command_buffer.h" | 24 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 24 #include "content/common/gpu/client/gl_helper.h" | 25 #include "content/common/gpu/client/gl_helper.h" |
| 25 #include "content/common/gpu/client/gpu_channel_host.h" | 26 #include "content/common/gpu/client/gpu_channel_host.h" |
| 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 27 #include "content/common/gpu/gpu_messages.h" | 28 #include "content/common/gpu/gpu_messages.h" |
| 28 #include "content/common/gpu/gpu_process_launch_causes.h" | 29 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 29 #include "content/common/webkitplatformsupport_impl.h" | 30 #include "content/common/webkitplatformsupport_impl.h" |
| 30 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| 31 #include "gpu/GLES2/gl2extchromium.h" | 32 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 60 | 61 |
| 61 virtual ui::ContextFactory* AsContextFactory() OVERRIDE { | 62 virtual ui::ContextFactory* AsContextFactory() OVERRIDE { |
| 62 return context_factory_.get(); | 63 return context_factory_.get(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE { | 66 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE { |
| 66 return gfx::GLSurfaceHandle(); | 67 return gfx::GLSurfaceHandle(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 virtual void DestroySharedSurfaceHandle( | 70 virtual void DestroySharedSurfaceHandle( |
| 70 gfx::GLSurfaceHandle surface) OVERRIDE { | 71 gfx::GLSurfaceHandle surface, int surface_id) OVERRIDE { |
| 71 } | 72 } |
| 72 | 73 |
| 73 virtual scoped_refptr<ui::Texture> CreateTransportClient( | 74 virtual scoped_refptr<ui::Texture> CreateTransportClient( |
| 74 float device_scale_factor) OVERRIDE { | 75 float device_scale_factor) OVERRIDE { |
| 75 return NULL; | 76 return NULL; |
| 76 } | 77 } |
| 77 | 78 |
| 78 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( | 79 virtual scoped_refptr<ui::Texture> CreateOwnedTexture( |
| 79 const gfx::Size& size, | 80 const gfx::Size& size, |
| 80 float device_scale_factor, | 81 float device_scale_factor, |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( | 427 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( |
| 427 gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); | 428 gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); |
| 428 handle.parent_gpu_process_id = | 429 handle.parent_gpu_process_id = |
| 429 shared_contexts_main_thread_->Context3d()->GetGPUProcessID(); | 430 shared_contexts_main_thread_->Context3d()->GetGPUProcessID(); |
| 430 handle.parent_client_id = | 431 handle.parent_client_id = |
| 431 shared_contexts_main_thread_->Context3d()->GetChannelID(); | 432 shared_contexts_main_thread_->Context3d()->GetChannelID(); |
| 432 return handle; | 433 return handle; |
| 433 } | 434 } |
| 434 | 435 |
| 435 virtual void DestroySharedSurfaceHandle( | 436 virtual void DestroySharedSurfaceHandle( |
| 436 gfx::GLSurfaceHandle surface) OVERRIDE { | 437 gfx::GLSurfaceHandle surface, int surface_id) OVERRIDE { |
| 438 int gpu_host_id = |
| 439 shared_contexts_main_thread_->Context3d()->GetGPUProcessID(); |
| 440 int client_id = shared_contexts_main_thread_->Context3d()->GetChannelID(); |
| 441 int route_id = shared_contexts_main_thread_->Context3d()->GetContextID(); |
| 442 GpuProcessHostUIShim* ui_shim = |
| 443 GpuProcessHostUIShim::FromID(gpu_host_id); |
| 444 if (ui_shim) |
| 445 ui_shim->Send(new GpuMsg_DestroySurface(client_id, route_id, surface_id)); |
| 437 } | 446 } |
| 438 | 447 |
| 439 virtual scoped_refptr<ui::Texture> CreateTransportClient( | 448 virtual scoped_refptr<ui::Texture> CreateTransportClient( |
| 440 float device_scale_factor) OVERRIDE { | 449 float device_scale_factor) OVERRIDE { |
| 441 if (!shared_contexts_main_thread_) | 450 if (!shared_contexts_main_thread_) |
| 442 return NULL; | 451 return NULL; |
| 443 scoped_refptr<ImageTransportClientTexture> image( | 452 scoped_refptr<ImageTransportClientTexture> image( |
| 444 new ImageTransportClientTexture( | 453 new ImageTransportClientTexture( |
| 445 shared_contexts_main_thread_->Context3d(), | 454 shared_contexts_main_thread_->Context3d(), |
| 446 device_scale_factor)); | 455 device_scale_factor)); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 delete g_factory; | 775 delete g_factory; |
| 767 g_factory = NULL; | 776 g_factory = NULL; |
| 768 } | 777 } |
| 769 | 778 |
| 770 // static | 779 // static |
| 771 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 780 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
| 772 return g_factory; | 781 return g_factory; |
| 773 } | 782 } |
| 774 | 783 |
| 775 } // namespace content | 784 } // namespace content |
| OLD | NEW |