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

Side by Side Diff: cc/blink/web_external_bitmap_impl.cc

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/blink/web_external_bitmap_impl.h ('k') | cc/blink/web_external_texture_layer_impl.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/blink/web_external_bitmap_impl.h" 5 #include "cc/blink/web_external_bitmap_impl.h"
6 6
7 #include "base/memory/shared_memory.h" 7 #include "cc/resources/shared_bitmap.h"
8 8
9 namespace cc_blink { 9 namespace cc_blink {
10 10
11 namespace { 11 namespace {
12 12
13 SharedMemoryAllocationFunction g_memory_allocator; 13 SharedBitmapAllocationFunction g_memory_allocator;
14 14
15 } // namespace 15 } // namespace
16 16
17 void SetSharedMemoryAllocationFunction( 17 void SetSharedBitmapAllocationFunction(
18 SharedMemoryAllocationFunction allocator) { 18 SharedBitmapAllocationFunction allocator) {
19 g_memory_allocator = allocator; 19 g_memory_allocator = allocator;
20 } 20 }
21 21
22 WebExternalBitmapImpl::WebExternalBitmapImpl() { 22 WebExternalBitmapImpl::WebExternalBitmapImpl() {
23 } 23 }
24 24
25 WebExternalBitmapImpl::~WebExternalBitmapImpl() { 25 WebExternalBitmapImpl::~WebExternalBitmapImpl() {
26 } 26 }
27 27
28 void WebExternalBitmapImpl::setSize(blink::WebSize size) { 28 void WebExternalBitmapImpl::setSize(blink::WebSize size) {
29 if (size != size_) { 29 if (size != size_) {
30 size_t byte_size = size.width * size.height * 4; 30 shared_bitmap_ = g_memory_allocator(gfx::Size(size));
31 shared_memory_ = g_memory_allocator(byte_size);
32 if (shared_memory_)
33 shared_memory_->Map(byte_size);
34 size_ = size; 31 size_ = size;
35 } 32 }
36 } 33 }
37 34
38 blink::WebSize WebExternalBitmapImpl::size() { 35 blink::WebSize WebExternalBitmapImpl::size() {
39 return size_; 36 return size_;
40 } 37 }
41 38
42 uint8* WebExternalBitmapImpl::pixels() { 39 uint8* WebExternalBitmapImpl::pixels() {
43 return static_cast<uint8*>(shared_memory_->memory()); 40 return shared_bitmap_->pixels();
44 } 41 }
45 42
46 } // namespace cc_blink 43 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_external_bitmap_impl.h ('k') | cc/blink/web_external_texture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698