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

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

Issue 148243013: Add shared bitmap managers for browser and renderer processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
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 #include "cc/resources/shared_bitmap.h" 5 #include "cc/resources/shared_bitmap.h"
6 6
7 #include "base/rand_util.h"
8
7 namespace cc { 9 namespace cc {
8 10
9 SharedBitmap::SharedBitmap( 11 SharedBitmap::SharedBitmap(
10 base::SharedMemory* memory, 12 base::SharedMemory* memory,
11 const SharedBitmapId& id, 13 const SharedBitmapId& id,
12 const base::Callback<void(SharedBitmap*)>& free_callback) 14 const base::Callback<void(SharedBitmap*)>& free_callback)
13 : memory_(memory), id_(id), free_callback_(free_callback) {} 15 : memory_(memory), id_(id), free_callback_(free_callback) {}
14 16
15 SharedBitmap::~SharedBitmap() { free_callback_.Run(this); } 17 SharedBitmap::~SharedBitmap() { free_callback_.Run(this); }
16 18
19 // static
20 size_t SharedBitmap::GetSizeInBytes(const gfx::Size& size) {
21 return size.GetArea() * 4;
22 }
23
24 // static
25 SharedBitmapId SharedBitmap::GenerateId() {
26 SharedBitmapId id;
27 base::RandBytes(id.name, sizeof id.name);
danakj 2014/01/30 22:59:01 nit: sizeof(id.name)
28 return id;
29 }
30
17 } // namespace cc 31 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698