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

Side by Side Diff: ui/gl/gl_image_ref_counted_memory.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
« no previous file with comments | « ui/gl/gl_image_memory.cc ('k') | ui/gl/gl_image_shared_memory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/gl/gl_image_ref_counted_memory.h" 5 #include "ui/gl/gl_image_ref_counted_memory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/trace_event/memory_allocator_dump.h" 9 #include "base/trace_event/memory_allocator_dump.h"
10 #include "base/trace_event/memory_dump_manager.h" 10 #include "base/trace_event/memory_dump_manager.h"
11 #include "base/trace_event/process_memory_dump.h" 11 #include "base/trace_event/process_memory_dump.h"
12 #include "ui/gfx/buffer_format_util.h"
12 13
13 namespace gl { 14 namespace gl {
14 15
15 GLImageRefCountedMemory::GLImageRefCountedMemory(const gfx::Size& size, 16 GLImageRefCountedMemory::GLImageRefCountedMemory(const gfx::Size& size,
16 unsigned internalformat) 17 unsigned internalformat)
17 : GLImageMemory(size, internalformat) {} 18 : GLImageMemory(size, internalformat) {}
18 19
19 GLImageRefCountedMemory::~GLImageRefCountedMemory() { 20 GLImageRefCountedMemory::~GLImageRefCountedMemory() {
20 DCHECK(!ref_counted_memory_.get()); 21 DCHECK(!ref_counted_memory_.get());
21 } 22 }
22 23
23 bool GLImageRefCountedMemory::Initialize( 24 bool GLImageRefCountedMemory::Initialize(
24 base::RefCountedMemory* ref_counted_memory, 25 base::RefCountedMemory* ref_counted_memory,
25 gfx::BufferFormat format) { 26 gfx::BufferFormat format) {
26 if (!GLImageMemory::Initialize(ref_counted_memory->front(), format)) 27 if (!GLImageMemory::Initialize(
28 ref_counted_memory->front(), format,
29 gfx::RowSizeForBufferFormat(GetSize().width(), format, 0))) {
27 return false; 30 return false;
31 }
28 32
29 DCHECK(!ref_counted_memory_.get()); 33 DCHECK(!ref_counted_memory_.get());
30 ref_counted_memory_ = ref_counted_memory; 34 ref_counted_memory_ = ref_counted_memory;
31 return true; 35 return true;
32 } 36 }
33 37
34 void GLImageRefCountedMemory::Destroy(bool have_context) { 38 void GLImageRefCountedMemory::Destroy(bool have_context) {
35 GLImageMemory::Destroy(have_context); 39 GLImageMemory::Destroy(have_context);
36 ref_counted_memory_ = nullptr; 40 ref_counted_memory_ = nullptr;
37 } 41 }
(...skipping 12 matching lines...) Expand all
50 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 54 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
51 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 55 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
52 static_cast<uint64_t>(size_in_bytes)); 56 static_cast<uint64_t>(size_in_bytes));
53 57
54 pmd->AddSuballocation(dump->guid(), 58 pmd->AddSuballocation(dump->guid(),
55 base::trace_event::MemoryDumpManager::GetInstance() 59 base::trace_event::MemoryDumpManager::GetInstance()
56 ->system_allocator_pool_name()); 60 ->system_allocator_pool_name());
57 } 61 }
58 62
59 } // namespace gl 63 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_image_memory.cc ('k') | ui/gl/gl_image_shared_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698