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

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

Issue 1403283007: Re-land: ui: Add custom stride support to GLImageMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more missing static_casts Created 5 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 "content/common/gpu/gpu_channel.h" 5 #include "content/common/gpu/gpu_channel.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <deque> 12 #include <deque>
13 #include <set> 13 #include <set>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/atomicops.h" 16 #include "base/atomicops.h"
17 #include "base/bind.h" 17 #include "base/bind.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/location.h" 19 #include "base/location.h"
20 #include "base/numerics/safe_conversions.h"
20 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
21 #include "base/stl_util.h" 22 #include "base/stl_util.h"
22 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
23 #include "base/synchronization/lock.h" 24 #include "base/synchronization/lock.h"
24 #include "base/thread_task_runner_handle.h" 25 #include "base/thread_task_runner_handle.h"
25 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
26 #include "base/trace_event/memory_dump_manager.h" 27 #include "base/trace_event/memory_dump_manager.h"
27 #include "base/trace_event/process_memory_dump.h" 28 #include "base/trace_event/process_memory_dump.h"
28 #include "base/trace_event/trace_event.h" 29 #include "base/trace_event/trace_event.h"
29 #include "content/common/gpu/gpu_channel_manager.h" 30 #include "content/common/gpu/gpu_channel_manager.h"
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 return size; 1034 return size;
1034 } 1035 }
1035 1036
1036 scoped_refptr<gl::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer( 1037 scoped_refptr<gl::GLImage> GpuChannel::CreateImageForGpuMemoryBuffer(
1037 const gfx::GpuMemoryBufferHandle& handle, 1038 const gfx::GpuMemoryBufferHandle& handle,
1038 const gfx::Size& size, 1039 const gfx::Size& size,
1039 gfx::BufferFormat format, 1040 gfx::BufferFormat format,
1040 uint32 internalformat) { 1041 uint32 internalformat) {
1041 switch (handle.type) { 1042 switch (handle.type) {
1042 case gfx::SHARED_MEMORY_BUFFER: { 1043 case gfx::SHARED_MEMORY_BUFFER: {
1044 if (!base::IsValueInRangeForNumericType<size_t>(handle.stride))
1045 return nullptr;
1043 scoped_refptr<gl::GLImageSharedMemory> image( 1046 scoped_refptr<gl::GLImageSharedMemory> image(
1044 new gl::GLImageSharedMemory(size, internalformat)); 1047 new gl::GLImageSharedMemory(size, internalformat));
1045 if (!image->Initialize(handle.handle, handle.id, format, handle.offset)) 1048 if (!image->Initialize(handle.handle, handle.id, format, handle.offset,
1049 handle.stride)) {
1046 return nullptr; 1050 return nullptr;
1051 }
1047 1052
1048 return image; 1053 return image;
1049 } 1054 }
1050 default: { 1055 default: {
1051 GpuChannelManager* manager = gpu_channel_manager(); 1056 GpuChannelManager* manager = gpu_channel_manager();
1052 if (!manager->gpu_memory_buffer_factory()) 1057 if (!manager->gpu_memory_buffer_factory())
1053 return nullptr; 1058 return nullptr;
1054 1059
1055 return manager->gpu_memory_buffer_factory() 1060 return manager->gpu_memory_buffer_factory()
1056 ->AsImageFactory() 1061 ->AsImageFactory()
1057 ->CreateImageForGpuMemoryBuffer(handle, 1062 ->CreateImageForGpuMemoryBuffer(handle,
1058 size, 1063 size,
1059 format, 1064 format,
1060 internalformat, 1065 internalformat,
1061 client_id_); 1066 client_id_);
1062 } 1067 }
1063 } 1068 }
1064 } 1069 }
1065 1070
1066 void GpuChannel::HandleUpdateValueState( 1071 void GpuChannel::HandleUpdateValueState(
1067 unsigned int target, const gpu::ValueState& state) { 1072 unsigned int target, const gpu::ValueState& state) {
1068 pending_valuebuffer_state_->UpdateState(target, state); 1073 pending_valuebuffer_state_->UpdateState(target, state);
1069 } 1074 }
1070 1075
1071 } // namespace content 1076 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698