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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl.h

Issue 1055403010: content: Add GpuMemoryBuffer MemoryDumpProvider implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: save register of dump provider to follow up patch Created 5 years, 8 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 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
(...skipping 18 matching lines...) Expand all
29 const gfx::Size& size, 29 const gfx::Size& size,
30 Format format, 30 Format format,
31 const DestructionCallback& callback); 31 const DestructionCallback& callback);
32 32
33 // Type-checking upcast routine. Returns an NULL on failure. 33 // Type-checking upcast routine. Returns an NULL on failure.
34 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); 34 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
35 35
36 // Returns the number of planes based on the format of the buffer. 36 // Returns the number of planes based on the format of the buffer.
37 static size_t NumberOfPlanesForGpuMemoryBufferFormat(Format format); 37 static size_t NumberOfPlanesForGpuMemoryBufferFormat(Format format);
38 38
39 // Calculates the number of bytes that an implementation must use to store
40 // one row of pixel data.
41 static bool StrideInBytes(size_t width,
42 Format format,
43 int plane,
44 size_t* stride_in_bytes);
45
46 // Returns the subsampling factor applied to the given zero-indexed |plane| of 39 // Returns the subsampling factor applied to the given zero-indexed |plane| of
47 // the |format| both horizontally and vertically. 40 // the |format| both horizontally and vertically.
48 static size_t SubsamplingFactor(Format format, int plane); 41 static size_t SubsamplingFactor(Format format, int plane);
49 42
43 // Returns the number of bytes used to store a row of the given zero-indexed
44 // |plane| of |format|.
45 // Note: This is an approximation and the exact size used by an implementation
46 // might be different.
47 static bool RowSizeInBytes(size_t width,
48 Format format,
49 int plane,
50 size_t* size_in_bytes);
51
52 // Returns the number of bytes used to store all the planes of a given
53 // |format|.
54 // Note: This is an approximation and the exact size used by an implementation
55 // might be different.
56 static bool BufferSizeInBytes(const gfx::Size& size,
Daniele Castagna 2015/04/27 19:07:47 What about keeping GpuMemoryBufferImplSharedMemory
reveman 2015/04/27 19:30:30 I don't think we should have the base class depend
Daniele Castagna 2015/04/27 19:43:56 With this patch there might not be an explicit cod
reveman 2015/04/27 20:28:08 That's not the case. BufferSizeInBytes returns a m
57 Format format,
58 size_t* size_in_bytes);
59
50 // Overridden from gfx::GpuMemoryBuffer: 60 // Overridden from gfx::GpuMemoryBuffer:
51 bool IsMapped() const override; 61 bool IsMapped() const override;
52 Format GetFormat() const override; 62 Format GetFormat() const override;
53 ClientBuffer AsClientBuffer() override; 63 ClientBuffer AsClientBuffer() override;
54 64
55 void set_destruction_sync_point(uint32 sync_point) { 65 void set_destruction_sync_point(uint32 sync_point) {
56 destruction_sync_point_ = sync_point; 66 destruction_sync_point_ = sync_point;
57 } 67 }
58 68
59 protected: 69 protected:
60 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, 70 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
61 const gfx::Size& size, 71 const gfx::Size& size,
62 Format format, 72 Format format,
63 const DestructionCallback& callback); 73 const DestructionCallback& callback);
64 74
65 const gfx::GpuMemoryBufferId id_; 75 const gfx::GpuMemoryBufferId id_;
66 const gfx::Size size_; 76 const gfx::Size size_;
67 const Format format_; 77 const Format format_;
68 const DestructionCallback callback_; 78 const DestructionCallback callback_;
69 bool mapped_; 79 bool mapped_;
70 uint32 destruction_sync_point_; 80 uint32 destruction_sync_point_;
71 81
72 private: 82 private:
73 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 83 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
74 }; 84 };
75 85
76 } // namespace content 86 } // namespace content
77 87
78 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 88 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698