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

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: Fix android build. 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
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 202
201 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 203 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
202 int z_order, 204 int z_order,
203 OverlayTransform transform, 205 OverlayTransform transform,
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
212 void GLImageIOSurface::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
213 uint64_t process_tracing_id,
214 const std::string& dump_name) {
215 // IOSurfaceGetAllocSize will return 0 if io_surface_ is invalid. In this case
216 // we log 0 for consistency with other GLImage memory dump functions.
217 size_t size_bytes = IOSurfaceGetAllocSize(io_surface_);
218
219 base::trace_event::MemoryAllocatorDump* dump =
220 pmd->CreateAllocatorDump(dump_name);
221 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
222 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
223 static_cast<uint64_t>(size_bytes));
224
225 auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
226 io_surface_id_);
227 pmd->CreateSharedGlobalAllocatorDump(guid);
228 pmd->AddOwnershipEdge(dump->guid(), guid);
229 }
230
210 base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() { 231 base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() {
211 return io_surface_; 232 return io_surface_;
212 } 233 }
213 234
214 // static 235 // static
215 void GLImageIOSurface::SetLayerForWidget( 236 void GLImageIOSurface::SetLayerForWidget(
216 gfx::AcceleratedWidget widget, CALayer* layer) { 237 gfx::AcceleratedWidget widget, CALayer* layer) {
217 if (layer) 238 if (layer)
218 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); 239 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer));
219 else 240 else
220 g_widget_to_layer_map.Pointer()->erase(widget); 241 g_widget_to_layer_map.Pointer()->erase(widget);
221 } 242 }
222 243
223 } // namespace gfx 244 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698