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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 10543125: gpu: Add support for GLX_EXT_texture_from_pixmap extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move CreateGLImage below virtual methods. Created 8 years, 2 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/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return result; 471 return result;
472 } 472 }
473 473
474 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 474 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
475 DCHECK(CalledOnValidThread()); 475 DCHECK(CalledOnValidThread());
476 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 476 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
477 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized) 477 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized)
478 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 478 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
479 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) 479 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
480 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) 480 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer)
481 IPC_MESSAGE_HANDLER(GpuHostMsg_ImageCreated, OnImageCreated)
481 #if defined(OS_MACOSX) 482 #if defined(OS_MACOSX)
482 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 483 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
483 OnAcceleratedSurfaceBuffersSwapped) 484 OnAcceleratedSurfaceBuffersSwapped)
484 #endif 485 #endif
485 #if defined(OS_WIN) 486 #if defined(OS_WIN)
486 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 487 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
487 OnAcceleratedSurfaceBuffersSwapped) 488 OnAcceleratedSurfaceBuffersSwapped)
488 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, 489 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer,
489 OnAcceleratedSurfacePostSubBuffer) 490 OnAcceleratedSurfacePostSubBuffer)
490 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, 491 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 compositing_surface, surface_id, client_id, init_params))) { 560 compositing_surface, surface_id, client_id, init_params))) {
560 create_command_buffer_requests_.push(callback); 561 create_command_buffer_requests_.push(callback);
561 #if defined(TOOLKIT_GTK) 562 #if defined(TOOLKIT_GTK)
562 surface_refs_.insert(std::make_pair(surface_id, surface_ref)); 563 surface_refs_.insert(std::make_pair(surface_id, surface_ref));
563 #endif 564 #endif
564 } else { 565 } else {
565 CreateCommandBufferError(callback, MSG_ROUTING_NONE); 566 CreateCommandBufferError(callback, MSG_ROUTING_NONE);
566 } 567 }
567 } 568 }
568 569
570 void GpuProcessHost::CreateImage(
571 gfx::PluginWindowHandle window,
572 int client_id,
573 int image_id,
574 const CreateImageCallback& callback) {
575 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::CreateImage");
576
577 DCHECK(CalledOnValidThread());
578
579 if (Send(new GpuMsg_CreateImage(window, client_id, image_id))) {
580 create_image_requests_.push(callback);
581 } else {
582 CreateImageError(callback, gfx::Size());
583 }
584 }
585
586 void GpuProcessHost::DeleteImage(
587 int client_id,
588 int image_id) {
589 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::DeleteImage");
590
591 DCHECK(CalledOnValidThread());
592
593 Send(new GpuMsg_DeleteImage(client_id, image_id));
594 }
595
569 void GpuProcessHost::OnInitialized(bool result) { 596 void GpuProcessHost::OnInitialized(bool result) {
570 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); 597 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
571 } 598 }
572 599
573 void GpuProcessHost::OnChannelEstablished( 600 void GpuProcessHost::OnChannelEstablished(
574 const IPC::ChannelHandle& channel_handle) { 601 const IPC::ChannelHandle& channel_handle) {
575 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnChannelEstablished"); 602 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnChannelEstablished");
576 603
577 EstablishChannelCallback callback = channel_requests_.front(); 604 EstablishChannelCallback callback = channel_requests_.front();
578 channel_requests_.pop(); 605 channel_requests_.pop();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { 641 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
615 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnDestroyCommandBuffer"); 642 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnDestroyCommandBuffer");
616 643
617 #if defined(TOOLKIT_GTK) 644 #if defined(TOOLKIT_GTK)
618 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 645 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
619 if (it != surface_refs_.end()) 646 if (it != surface_refs_.end())
620 surface_refs_.erase(it); 647 surface_refs_.erase(it);
621 #endif // defined(TOOLKIT_GTK) 648 #endif // defined(TOOLKIT_GTK)
622 } 649 }
623 650
651 void GpuProcessHost::OnImageCreated(const gfx::Size size) {
652 TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated");
653
654 if (!create_image_requests_.empty()) {
655 CreateImageCallback callback = create_image_requests_.front();
656 create_image_requests_.pop();
657 callback.Run(size);
658 }
659 }
660
624 #if defined(OS_MACOSX) 661 #if defined(OS_MACOSX)
625 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 662 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
626 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 663 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
627 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 664 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
628 665
629 gfx::PluginWindowHandle handle = 666 gfx::PluginWindowHandle handle =
630 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 667 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
631 // Compositor window is always gfx::kNullPluginWindow. 668 // Compositor window is always gfx::kNullPluginWindow.
632 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 669 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
633 // plugin windows. 670 // plugin windows.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 const IPC::ChannelHandle& channel_handle, 944 const IPC::ChannelHandle& channel_handle,
908 base::ProcessHandle renderer_process_for_gpu, 945 base::ProcessHandle renderer_process_for_gpu,
909 const content::GPUInfo& gpu_info) { 946 const content::GPUInfo& gpu_info) {
910 callback.Run(channel_handle, gpu_info); 947 callback.Run(channel_handle, gpu_info);
911 } 948 }
912 949
913 void GpuProcessHost::CreateCommandBufferError( 950 void GpuProcessHost::CreateCommandBufferError(
914 const CreateCommandBufferCallback& callback, int32 route_id) { 951 const CreateCommandBufferCallback& callback, int32 route_id) {
915 callback.Run(route_id); 952 callback.Run(route_id);
916 } 953 }
954
955 void GpuProcessHost::CreateImageError(
956 const CreateImageCallback& callback, const gfx::Size size) {
957 callback.Run(size);
958 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698