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

Side by Side Diff: ui/gl/gl_image_io_surface.mm

Issue 1299713003: GLImage::OnMemoryDump Stubs + Some Impls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@images1.3
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_io_surface.h" 5 #include "ui/gl/gl_image_io_surface.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 NOTREACHED(); 120 NOTREACHED();
121 return 0; 121 return 0;
122 } 122 }
123 123
124 NOTREACHED(); 124 NOTREACHED();
125 return 0; 125 return 0;
126 } 126 }
127 127
128 } // namespace 128 } // namespace
129 129
130 GLImageIOSurface::GLImageIOSurface(const gfx::Size& size, 130 GLImageIOSurface::GLImageIOSurface(gfx::GenericSharedMemoryId io_surface_id,
131 const gfx::Size& size,
131 unsigned internalformat) 132 unsigned internalformat)
132 : size_(size), 133 : io_surface_id_(io_surface_id),
134 size_(size),
133 internalformat_(internalformat), 135 internalformat_(internalformat),
134 format_(BufferFormat::RGBA_8888) {} 136 format_(BufferFormat::RGBA_8888) {}
135 137
136 GLImageIOSurface::~GLImageIOSurface() { 138 GLImageIOSurface::~GLImageIOSurface() {
137 DCHECK(thread_checker_.CalledOnValidThread()); 139 DCHECK(thread_checker_.CalledOnValidThread());
138 DCHECK(!io_surface_); 140 DCHECK(!io_surface_);
139 } 141 }
140 142
141 bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface, 143 bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface,
142 BufferFormat format) { 144 BufferFormat format) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 const Rect& bounds_rect, 206 const Rect& bounds_rect,
205 const RectF& crop_rect) { 207 const RectF& crop_rect) {
206 NOTREACHED(); 208 NOTREACHED();
207 return false; 209 return false;
208 } 210 }
209 211
210 base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() { 212 base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() {
211 return io_surface_; 213 return io_surface_;
212 } 214 }
213 215
216 void GLImageIOSurface::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
217 uint64_t process_tracing_id,
218 const std::string& dump_name) {
219 size_t size_bytes = IOSurfaceGetAllocSize(io_surface_);
220
221 base::trace_event::MemoryAllocatorDump* dump =
222 pmd->CreateAllocatorDump(dump_name);
223 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
224 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
225 static_cast<uint64_t>(size_bytes));
226
227 auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
228 io_surface_id_);
229 pmd->CreateSharedGlobalAllocatorDump(guid);
230 pmd->AddOwnershipEdge(dump->guid(), guid);
231 }
232
214 // static 233 // static
215 void GLImageIOSurface::SetLayerForWidget( 234 void GLImageIOSurface::SetLayerForWidget(
216 gfx::AcceleratedWidget widget, CALayer* layer) { 235 gfx::AcceleratedWidget widget, CALayer* layer) {
217 if (layer) 236 if (layer)
218 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); 237 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer));
219 else 238 else
220 g_widget_to_layer_map.Pointer()->erase(widget); 239 g_widget_to_layer_map.Pointer()->erase(widget);
221 } 240 }
222 241
223 } // namespace gfx 242 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698