Don't add extra app list launcher page webviews.
[chromium-blink-merge.git] / cc / resources / shared_bitmap.h
blob6980afbc11265a32b3f127fc4af927970380ada4
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
3 // found in the LICENSE file.
5 #ifndef CC_RESOURCES_SHARED_BITMAP_H_
6 #define CC_RESOURCES_SHARED_BITMAP_H_
8 #include "base/basictypes.h"
9 #include "cc/base/cc_export.h"
10 #include "gpu/command_buffer/common/mailbox.h"
11 #include "ui/gfx/geometry/size.h"
13 namespace cc {
14 typedef gpu::Mailbox SharedBitmapId;
16 class CC_EXPORT SharedBitmap {
17 public:
18 SharedBitmap(uint8* pixels, const SharedBitmapId& id);
20 virtual ~SharedBitmap();
22 uint8* pixels() { return pixels_; }
24 const SharedBitmapId& id() { return id_; }
26 // Returns true if the size is valid and false otherwise.
27 static bool SizeInBytes(const gfx::Size& size, size_t* size_in_bytes);
28 // Dies with a CRASH() if the size can not be represented as a positive number
29 // of bytes.
30 static size_t CheckedSizeInBytes(const gfx::Size& size);
31 // Returns the size in bytes but may overflow or return 0. Only do this for
32 // sizes that have already been checked.
33 static size_t UncheckedSizeInBytes(const gfx::Size& size);
34 // Returns true if the size is valid and false otherwise.
35 static bool VerifySizeInBytes(const gfx::Size& size);
37 static SharedBitmapId GenerateId();
39 private:
40 uint8* pixels_;
41 SharedBitmapId id_;
43 DISALLOW_COPY_AND_ASSIGN(SharedBitmap);
46 } // namespace cc
48 #endif // CC_RESOURCES_SHARED_BITMAP_H_