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

Side by Side Diff: content/renderer/pepper/pepper_platform_image_2d_impl.cc

Issue 13529027: Switch Linux Auru ports over to POSIX SHM instead of legacy SYSV SHM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_platform_image_2d_impl.h" 5 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "ui/surface/transport_dib.h" 10 #include "ui/surface/transport_dib.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 PepperPlatformImage2DImpl::PepperPlatformImage2DImpl(int width, 14 PepperPlatformImage2DImpl::PepperPlatformImage2DImpl(int width,
15 int height, 15 int height,
16 TransportDIB* dib) 16 TransportDIB* dib)
17 : width_(width), 17 : width_(width),
18 height_(height), 18 height_(height),
19 dib_(dib) { 19 dib_(dib) {
20 } 20 }
21 21
22 // On Mac, we have to tell the browser to free the transport DIB. 22 // On POSIX, we have to tell the browser to free the transport DIB.
23 PepperPlatformImage2DImpl::~PepperPlatformImage2DImpl() { 23 PepperPlatformImage2DImpl::~PepperPlatformImage2DImpl() {
24 #if defined(OS_MACOSX) 24 #if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID)
25 if (dib_) { 25 if (dib_) {
26 RenderThreadImpl::current()->Send( 26 RenderThreadImpl::current()->Send(
27 new ViewHostMsg_FreeTransportDIB(dib_->id())); 27 new ViewHostMsg_FreeTransportDIB(dib_->id()));
28 } 28 }
29 #endif 29 #endif
30 } 30 }
31 31
32 // static 32 // static
33 PepperPlatformImage2DImpl* PepperPlatformImage2DImpl::Create(int width, 33 PepperPlatformImage2DImpl* PepperPlatformImage2DImpl::Create(int width,
34 int height) { 34 int height) {
35 uint32 buffer_size = width * height * 4; 35 uint32 buffer_size = width * height * 4;
36 36
37 // Allocate the transport DIB and the PlatformCanvas pointing to it. 37 // Allocate the transport DIB and the PlatformCanvas pointing to it.
38 #if defined(OS_MACOSX) 38 #if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID)
39 // On the Mac, shared memory has to be created in the browser in order to 39 // On the Mac, shared memory has to be created in the browser in order to
40 // work in the sandbox. Do this by sending a message to the browser 40 // work in the sandbox. Do this by sending a message to the browser
41 // requesting a TransportDIB (see also 41 // requesting a TransportDIB (see also
42 // chrome/renderer/webplugin_delegate_proxy.cc, method 42 // chrome/renderer/webplugin_delegate_proxy.cc, method
43 // WebPluginDelegateProxy::CreateBitmap() for similar code). The TransportDIB 43 // WebPluginDelegateProxy::CreateBitmap() for similar code). The TransportDIB
44 // is cached in the browser, and is freed (in typical cases) by the 44 // is cached in the browser, and is freed (in typical cases) by the
45 // PepperPlatformImage2DImpl's destructor. 45 // PepperPlatformImage2DImpl's destructor.
46 TransportDIB::Handle dib_handle; 46 TransportDIB::Handle dib_handle;
47 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(buffer_size, 47 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(buffer_size,
48 true, 48 true,
(...skipping 16 matching lines...) Expand all
65 65
66 SkCanvas* PepperPlatformImage2DImpl::Map() { 66 SkCanvas* PepperPlatformImage2DImpl::Map() {
67 return dib_->GetPlatformCanvas(width_, height_); 67 return dib_->GetPlatformCanvas(width_, height_);
68 } 68 }
69 69
70 intptr_t PepperPlatformImage2DImpl::GetSharedMemoryHandle( 70 intptr_t PepperPlatformImage2DImpl::GetSharedMemoryHandle(
71 uint32* byte_count) const { 71 uint32* byte_count) const {
72 *byte_count = dib_->size(); 72 *byte_count = dib_->size();
73 #if defined(OS_WIN) 73 #if defined(OS_WIN)
74 return reinterpret_cast<intptr_t>(dib_->handle()); 74 return reinterpret_cast<intptr_t>(dib_->handle());
75 #elif defined(OS_MACOSX) || defined(OS_ANDROID) 75 #elif defined(TOOLKIT_GTK)
76 return static_cast<intptr_t>(dib_->handle());
77 #else
76 return static_cast<intptr_t>(dib_->handle().fd); 78 return static_cast<intptr_t>(dib_->handle().fd);
77 #elif defined(OS_POSIX)
78 return static_cast<intptr_t>(dib_->handle());
79 #endif 79 #endif
80 } 80 }
81 81
82 TransportDIB* PepperPlatformImage2DImpl::GetTransportDIB() const { 82 TransportDIB* PepperPlatformImage2DImpl::GetTransportDIB() const {
83 return dib_.get(); 83 return dib_.get();
84 } 84 }
85 85
86 } // namespace content 86 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_render_process_host.cc ('k') | content/renderer/pepper/pepper_video_source_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698