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

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

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « cc/resources/scoped_gpu_raster.cc ('k') | cc/resources/shared_bitmap_manager.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 #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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
11 #include "gpu/command_buffer/common/mailbox.h" 10 #include "gpu/command_buffer/common/mailbox.h"
12 #include "ui/gfx/geometry/size.h" 11 #include "ui/gfx/geometry/size.h"
13 12
14 namespace base { class SharedMemory; }
15
16 namespace cc { 13 namespace cc {
17 typedef gpu::Mailbox SharedBitmapId; 14 typedef gpu::Mailbox SharedBitmapId;
18 15
19 class CC_EXPORT SharedBitmap { 16 class CC_EXPORT SharedBitmap {
20 public: 17 public:
21 SharedBitmap(uint8* pixels, const SharedBitmapId& id); 18 SharedBitmap(uint8* pixels, const SharedBitmapId& id);
22 19
23 virtual ~SharedBitmap(); 20 virtual ~SharedBitmap();
24 21
25 uint8* pixels() { return pixels_; } 22 uint8* pixels() { return pixels_; }
26 23
27 virtual base::SharedMemory* memory() = 0;
28
29 const SharedBitmapId& id() { return id_; } 24 const SharedBitmapId& id() { return id_; }
30 25
31 // Returns true if the size is valid and false otherwise. 26 // Returns true if the size is valid and false otherwise.
32 static bool SizeInBytes(const gfx::Size& size, size_t* size_in_bytes); 27 static bool SizeInBytes(const gfx::Size& size, size_t* size_in_bytes);
33 // Dies with a CRASH() if the size can not be represented as a positive number 28 // Dies with a CRASH() if the size can not be represented as a positive number
34 // of bytes. 29 // of bytes.
35 static size_t CheckedSizeInBytes(const gfx::Size& size); 30 static size_t CheckedSizeInBytes(const gfx::Size& size);
36 // Returns the size in bytes but may overflow or return 0. Only do this for 31 // Returns the size in bytes but may overflow or return 0. Only do this for
37 // sizes that have already been checked. 32 // sizes that have already been checked.
38 static size_t UncheckedSizeInBytes(const gfx::Size& size); 33 static size_t UncheckedSizeInBytes(const gfx::Size& size);
39 // Returns true if the size is valid and false otherwise. 34 // Returns true if the size is valid and false otherwise.
40 static bool VerifySizeInBytes(const gfx::Size& size); 35 static bool VerifySizeInBytes(const gfx::Size& size);
41 36
42 static SharedBitmapId GenerateId(); 37 static SharedBitmapId GenerateId();
43 38
44 private: 39 private:
45 uint8* pixels_; 40 uint8* pixels_;
46 SharedBitmapId id_; 41 SharedBitmapId id_;
47 42
48 DISALLOW_COPY_AND_ASSIGN(SharedBitmap); 43 DISALLOW_COPY_AND_ASSIGN(SharedBitmap);
49 }; 44 };
50 45
51 } // namespace cc 46 } // namespace cc
52 47
53 #endif // CC_RESOURCES_SHARED_BITMAP_H_ 48 #endif // CC_RESOURCES_SHARED_BITMAP_H_
OLDNEW
« no previous file with comments | « cc/resources/scoped_gpu_raster.cc ('k') | cc/resources/shared_bitmap_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698