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

Side by Side Diff: webkit/renderer/compositor_bindings/web_external_bitmap_impl.cc

Issue 317163002: Moving compositor_bindings from webkit to content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing dependencies due to failing ios bots Created 6 years, 6 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
OLDNEW
(Empty)
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 "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h"
6
7 #include "base/memory/shared_memory.h"
8
9 namespace webkit {
10
11 namespace {
12
13 SharedMemoryAllocationFunction g_memory_allocator;
14
15 } // namespace
16
17 void SetSharedMemoryAllocationFunction(
18 SharedMemoryAllocationFunction allocator) {
19 g_memory_allocator = allocator;
20 }
21
22 WebExternalBitmapImpl::WebExternalBitmapImpl() {}
23
24 WebExternalBitmapImpl::~WebExternalBitmapImpl() {}
25
26 void WebExternalBitmapImpl::setSize(blink::WebSize size) {
27 if (size != size_) {
28 size_t byte_size = size.width * size.height * 4;
29 shared_memory_ = g_memory_allocator(byte_size);
30 if (shared_memory_)
31 shared_memory_->Map(byte_size);
32 size_ = size;
33 }
34 }
35
36 blink::WebSize WebExternalBitmapImpl::size() {
37 return size_;
38 }
39
40 uint8* WebExternalBitmapImpl::pixels() {
41 return static_cast<uint8*>(shared_memory_->memory());
42 }
43
44 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698