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. 4 5 #include "components/viz/common/resources/shared_bitmap.h" 6 7 #include <stddef.h> 8 #include <stdint.h> 9 10 #include "base/numerics/safe_math.h" 11 #include "base/rand_util.h" 12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/stringprintf.h" 14 #include "components/viz/common/resources/resource_format_utils.h" 15 16 namespace viz { 17 SharedBitmap(uint8_t * pixels)18SharedBitmap::SharedBitmap(uint8_t* pixels) : pixels_(pixels) {} 19 ~SharedBitmap()20SharedBitmap::~SharedBitmap() {} 21 22 // static GenerateId()23SharedBitmapId SharedBitmap::GenerateId() { 24 SharedBitmapId id; 25 // Needs cryptographically-secure random numbers. 26 base::RandBytes(id.name, sizeof(id.name)); 27 return id; 28 } 29 30 } // namespace viz 31