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

Side by Side Diff: cc/resources/shared_bitmap.h

Issue 2909873002: Add cc::SharedBitmap::shared_memory_handle() (Closed)
Patch Set: Created 3 years, 6 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 CC_RESOURCES_SHARED_BITMAP_H_ 5 #ifndef CC_RESOURCES_SHARED_BITMAP_H_
6 #define CC_RESOURCES_SHARED_BITMAP_H_ 6 #define CC_RESOURCES_SHARED_BITMAP_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/trace_event/memory_allocator_dump.h" 12 #include "base/trace_event/memory_allocator_dump.h"
13 #include "cc/cc_export.h" 13 #include "cc/cc_export.h"
14 #include "gpu/command_buffer/common/mailbox.h" 14 #include "gpu/command_buffer/common/mailbox.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 16
17 namespace base {
18
danakj 2017/05/31 16:10:31 nit: remove whitespace
hajimehoshi 2017/06/01 04:47:58 Done.
19 class SharedMemoryHandle;
20
danakj 2017/05/31 16:10:31 nit: remove whitespace
hajimehoshi 2017/06/01 04:47:58 Done.
21 } // namespace base
danakj 2017/05/31 16:10:31 nit: no need for this comment on such a short bloc
hajimehoshi 2017/06/01 04:47:57 Done.
22
17 namespace cc { 23 namespace cc {
18 typedef gpu::Mailbox SharedBitmapId; 24 typedef gpu::Mailbox SharedBitmapId;
19 25
20 CC_EXPORT base::trace_event::MemoryAllocatorDumpGuid 26 CC_EXPORT base::trace_event::MemoryAllocatorDumpGuid
21 GetSharedBitmapGUIDForTracing(const SharedBitmapId& bitmap_id); 27 GetSharedBitmapGUIDForTracing(const SharedBitmapId& bitmap_id);
22 28
23 class CC_EXPORT SharedBitmap { 29 class CC_EXPORT SharedBitmap {
24 public: 30 public:
25 SharedBitmap(uint8_t* pixels, const SharedBitmapId& id); 31 SharedBitmap(uint8_t* pixels, const SharedBitmapId& id);
26 32
27 virtual ~SharedBitmap(); 33 virtual ~SharedBitmap();
28 34
29 uint8_t* pixels() { return pixels_; } 35 uint8_t* pixels() { return pixels_; }
30 36
31 const SharedBitmapId& id() { return id_; } 37 const SharedBitmapId& id() { return id_; }
32 38
39 // Returns the shared memory's handle when the back end is base::SharedMemory.
40 // Otherwise, this returns an invalid handle.
41 virtual base::SharedMemoryHandle shared_memory_handle() const;
danakj 2017/05/31 16:10:31 Who will call this? You only implement this for th
hajimehoshi 2017/06/01 04:47:58 cc::ResourceProvider::Resource will call this. In
danakj 2017/06/01 13:25:49 Then why is there no override for ChildSharedBitma
danakj 2017/06/01 16:29:32 Can you make this pure virtual? That would force u
42
33 // Returns true if the size is valid and false otherwise. 43 // Returns true if the size is valid and false otherwise.
34 static bool SizeInBytes(const gfx::Size& size, size_t* size_in_bytes); 44 static bool SizeInBytes(const gfx::Size& size, size_t* size_in_bytes);
35 // Dies with a CRASH() if the size can not be represented as a positive number 45 // Dies with a CRASH() if the size can not be represented as a positive number
36 // of bytes. 46 // of bytes.
37 static size_t CheckedSizeInBytes(const gfx::Size& size); 47 static size_t CheckedSizeInBytes(const gfx::Size& size);
38 // Returns the size in bytes but may overflow or return 0. Only do this for 48 // Returns the size in bytes but may overflow or return 0. Only do this for
39 // sizes that have already been checked. 49 // sizes that have already been checked.
40 static size_t UncheckedSizeInBytes(const gfx::Size& size); 50 static size_t UncheckedSizeInBytes(const gfx::Size& size);
41 // Returns true if the size is valid and false otherwise. 51 // Returns true if the size is valid and false otherwise.
42 static bool VerifySizeInBytes(const gfx::Size& size); 52 static bool VerifySizeInBytes(const gfx::Size& size);
43 53
44 static SharedBitmapId GenerateId(); 54 static SharedBitmapId GenerateId();
45 55
46 private: 56 private:
47 uint8_t* pixels_; 57 uint8_t* pixels_;
48 SharedBitmapId id_; 58 SharedBitmapId id_;
49 59
50 DISALLOW_COPY_AND_ASSIGN(SharedBitmap); 60 DISALLOW_COPY_AND_ASSIGN(SharedBitmap);
51 }; 61 };
52 62
53 } // namespace cc 63 } // namespace cc
54 64
55 #endif // CC_RESOURCES_SHARED_BITMAP_H_ 65 #endif // CC_RESOURCES_SHARED_BITMAP_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/shared_bitmap.cc » ('j') | components/viz/display_compositor/host_shared_bitmap_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698