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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 659883003: gpu: Move image creation part of GpuMemoryBufferFactory interface to gpu namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-gpu-memory-buffer-manager-to-gpu
Patch Set: rebase Created 6 years, 1 month 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/common/gpu/image_transport_surface.h" 23 #include "content/common/gpu/image_transport_surface.h"
24 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 24 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
25 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" 25 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
26 #include "content/common/gpu/sync_point_manager.h" 26 #include "content/common/gpu/sync_point_manager.h"
27 #include "content/public/common/content_client.h" 27 #include "content/public/common/content_client.h"
28 #include "gpu/command_buffer/common/constants.h" 28 #include "gpu/command_buffer/common/constants.h"
29 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 29 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
30 #include "gpu/command_buffer/common/mailbox.h" 30 #include "gpu/command_buffer/common/mailbox.h"
31 #include "gpu/command_buffer/service/gl_context_virtual.h" 31 #include "gpu/command_buffer/service/gl_context_virtual.h"
32 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 32 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
33 #include "gpu/command_buffer/service/image_factory.h"
33 #include "gpu/command_buffer/service/image_manager.h" 34 #include "gpu/command_buffer/service/image_manager.h"
34 #include "gpu/command_buffer/service/logger.h" 35 #include "gpu/command_buffer/service/logger.h"
35 #include "gpu/command_buffer/service/mailbox_manager.h" 36 #include "gpu/command_buffer/service/mailbox_manager.h"
36 #include "gpu/command_buffer/service/memory_tracking.h" 37 #include "gpu/command_buffer/service/memory_tracking.h"
37 #include "gpu/command_buffer/service/query_manager.h" 38 #include "gpu/command_buffer/service/query_manager.h"
38 #include "ui/gl/gl_bindings.h" 39 #include "ui/gl/gl_bindings.h"
39 #include "ui/gl/gl_switches.h" 40 #include "ui/gl/gl_switches.h"
40 41
41 #if defined(OS_WIN) 42 #if defined(OS_WIN)
42 #include "content/public/common/sandbox_init.h" 43 #include "content/public/common/sandbox_init.h"
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 951
951 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 952 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
952 DCHECK(image_manager); 953 DCHECK(image_manager);
953 if (image_manager->LookupImage(id)) { 954 if (image_manager->LookupImage(id)) {
954 LOG(ERROR) << "Image already exists with same ID."; 955 LOG(ERROR) << "Image already exists with same ID.";
955 return; 956 return;
956 } 957 }
957 958
958 GpuChannelManager* manager = channel_->gpu_channel_manager(); 959 GpuChannelManager* manager = channel_->gpu_channel_manager();
959 scoped_refptr<gfx::GLImage> image = 960 scoped_refptr<gfx::GLImage> image =
960 manager->gpu_memory_buffer_factory()->CreateImageForGpuMemoryBuffer( 961 manager->gpu_memory_buffer_factory()
961 handle, size, format, internalformat, channel()->client_id()); 962 ->AsImageFactory()
963 ->CreateImageForGpuMemoryBuffer(
964 handle, size, format, internalformat, channel()->client_id());
962 if (!image.get()) 965 if (!image.get())
963 return; 966 return;
964 967
965 image_manager->AddImage(image.get(), id); 968 image_manager->AddImage(image.get(), id);
966 } 969 }
967 970
968 void GpuCommandBufferStub::OnDestroyImage(int32 id) { 971 void GpuCommandBufferStub::OnDestroyImage(int32 id) {
969 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); 972 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage");
970 973
971 if (!decoder_) 974 if (!decoder_)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 uint64 GpuCommandBufferStub::GetMemoryUsage() const { 1081 uint64 GpuCommandBufferStub::GetMemoryUsage() const {
1079 return GetMemoryManager()->GetClientMemoryUsage(this); 1082 return GetMemoryManager()->GetClientMemoryUsage(this);
1080 } 1083 }
1081 1084
1082 void GpuCommandBufferStub::SwapBuffersCompleted( 1085 void GpuCommandBufferStub::SwapBuffersCompleted(
1083 const std::vector<ui::LatencyInfo>& latency_info) { 1086 const std::vector<ui::LatencyInfo>& latency_info) {
1084 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); 1087 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info));
1085 } 1088 }
1086 1089
1087 } // namespace content 1090 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/gpu_memory_buffer_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698