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

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

Issue 2261623002: Make DrawingBuffer and Canvas2DLayerBridge be cc::TextureLayerClients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: webmailbox: fix-passrefptr Created 4 years, 4 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
« no previous file with comments | « cc/blink/web_external_bitmap_impl.h ('k') | cc/blink/web_external_texture_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/blink/web_external_bitmap_impl.h"
6
7 #include <stdint.h>
8
9 #include "cc/resources/shared_bitmap.h"
10
11 namespace cc_blink {
12
13 namespace {
14
15 SharedBitmapAllocationFunction g_memory_allocator;
16
17 } // namespace
18
19 void SetSharedBitmapAllocationFunction(
20 SharedBitmapAllocationFunction allocator) {
21 g_memory_allocator = allocator;
22 }
23
24 WebExternalBitmapImpl::WebExternalBitmapImpl() {
25 }
26
27 WebExternalBitmapImpl::~WebExternalBitmapImpl() {
28 }
29
30 void WebExternalBitmapImpl::setSize(blink::WebSize size) {
31 if (size != size_) {
32 shared_bitmap_ = g_memory_allocator(gfx::Size(size));
33 size_ = size;
34 }
35 }
36
37 blink::WebSize WebExternalBitmapImpl::size() {
38 return size_;
39 }
40
41 uint8_t* WebExternalBitmapImpl::pixels() {
42 if (!shared_bitmap_) {
43 // crbug.com/520417: not sure why a non-null WebExternalBitmap is
44 // being passed to prepareMailbox when the shared_bitmap_ is null.
45 // Best hypothesis is that the bitmap is zero-sized.
46 DCHECK(size_.isEmpty());
47 return nullptr;
48 }
49 return shared_bitmap_->pixels();
50 }
51
52 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_external_bitmap_impl.h ('k') | cc/blink/web_external_texture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698