Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1079 GLES2Interface* gl = resource_provider_->ContextGL(); | 1079 GLES2Interface* gl = resource_provider_->ContextGL(); |
| 1080 DCHECK(gl); | 1080 DCHECK(gl); |
| 1081 | 1081 |
| 1082 #if defined(OS_CHROMEOS) | 1082 #if defined(OS_CHROMEOS) |
| 1083 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization | 1083 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization |
| 1084 // on ChromeOS to avoid some performance issues. This only works with | 1084 // on ChromeOS to avoid some performance issues. This only works with |
| 1085 // shared memory backed buffers. crbug.com/436314 | 1085 // shared memory backed buffers. crbug.com/436314 |
| 1086 DCHECK_EQ(gpu_memory_buffer_->GetHandle().type, gfx::SHARED_MEMORY_BUFFER); | 1086 DCHECK_EQ(gpu_memory_buffer_->GetHandle().type, gfx::SHARED_MEMORY_BUFFER); |
| 1087 #endif | 1087 #endif |
| 1088 | 1088 |
| 1089 resource_->image_id = | 1089 ClientBuffer client_buffer = gpu_memory_buffer_->AsClientBuffer(); |
|
mcasas
2015/02/28 01:14:26
In this and similar temporary instantiations, can
emircan
2015/02/28 02:33:36
Changed it to a const ref to the temp object.
| |
| 1090 gl->CreateImageCHROMIUM(gpu_memory_buffer_->AsClientBuffer(), | 1090 resource_->image_id = gl->CreateImageCHROMIUM(&client_buffer, size_.width(), |
| 1091 size_.width(), | 1091 size_.height(), GL_RGBA); |
| 1092 size_.height(), | |
| 1093 GL_RGBA); | |
| 1094 } | 1092 } |
| 1095 | 1093 |
| 1096 std::swap(resource_->gpu_memory_buffer, gpu_memory_buffer_); | 1094 std::swap(resource_->gpu_memory_buffer, gpu_memory_buffer_); |
| 1097 resource_->allocated = true; | 1095 resource_->allocated = true; |
| 1098 resource_->dirty_image = true; | 1096 resource_->dirty_image = true; |
| 1099 | 1097 |
| 1100 // GpuMemoryBuffer provides direct access to the memory used by the GPU. | 1098 // GpuMemoryBuffer provides direct access to the memory used by the GPU. |
| 1101 // Read lock fences are required to ensure that we're not trying to map a | 1099 // Read lock fences are required to ensure that we're not trying to map a |
| 1102 // buffer that is currently in-use by the GPU. | 1100 // buffer that is currently in-use by the GPU. |
| 1103 resource_->read_lock_fences_enabled = true; | 1101 resource_->read_lock_fences_enabled = true; |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2171 } | 2169 } |
| 2172 | 2170 |
| 2173 class GrContext* ResourceProvider::GrContext(bool worker_context) const { | 2171 class GrContext* ResourceProvider::GrContext(bool worker_context) const { |
| 2174 ContextProvider* context_provider = | 2172 ContextProvider* context_provider = |
| 2175 worker_context ? output_surface_->worker_context_provider() | 2173 worker_context ? output_surface_->worker_context_provider() |
| 2176 : output_surface_->context_provider(); | 2174 : output_surface_->context_provider(); |
| 2177 return context_provider ? context_provider->GrContext() : NULL; | 2175 return context_provider ? context_provider->GrContext() : NULL; |
| 2178 } | 2176 } |
| 2179 | 2177 |
| 2180 } // namespace cc | 2178 } // namespace cc |
| OLD | NEW |