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

Side by Side Diff: chrome/common/transport_dib_linux.cc

Issue 159128: linux: add windowless plugin plumbing (Closed)
Patch Set: address review comments Created 11 years, 5 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 | « no previous file | chrome/plugin/webplugin_proxy.h » ('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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <errno.h> 5 #include <errno.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <sys/ipc.h> 7 #include <sys/ipc.h>
8 #include <sys/shm.h> 8 #include <sys/shm.h>
9 9
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 dib->address_ = address; 62 dib->address_ = address;
63 dib->size_ = size; 63 dib->size_ = size;
64 return dib; 64 return dib;
65 } 65 }
66 66
67 TransportDIB* TransportDIB::Map(Handle shmkey) { 67 TransportDIB* TransportDIB::Map(Handle shmkey) {
68 struct shmid_ds shmst; 68 struct shmid_ds shmst;
69 if (shmctl(shmkey, IPC_STAT, &shmst) == -1) 69 if (shmctl(shmkey, IPC_STAT, &shmst) == -1)
70 return NULL; 70 return NULL;
71 71
72 void* address = shmat(shmkey, NULL /* desired address */, SHM_RDONLY); 72 void* address = shmat(shmkey, NULL /* desired address */, 0 /* flags */);
73 if (address == kInvalidAddress) 73 if (address == kInvalidAddress)
74 return NULL; 74 return NULL;
75 75
76 TransportDIB* dib = new TransportDIB; 76 TransportDIB* dib = new TransportDIB;
77 77
78 dib->address_ = address; 78 dib->address_ = address;
79 dib->size_ = shmst.shm_segsz; 79 dib->size_ = shmst.shm_segsz;
80 dib->key_ = shmkey; 80 dib->key_ = shmkey;
81 return dib; 81 return dib;
82 } 82 }
(...skipping 17 matching lines...) Expand all
100 } 100 }
101 101
102 XID TransportDIB::MapToX(Display* display) { 102 XID TransportDIB::MapToX(Display* display) {
103 if (!x_shm_) { 103 if (!x_shm_) {
104 x_shm_ = x11_util::AttachSharedMemory(display, key_); 104 x_shm_ = x11_util::AttachSharedMemory(display, key_);
105 display_ = display; 105 display_ = display;
106 } 106 }
107 107
108 return x_shm_; 108 return x_shm_;
109 } 109 }
OLDNEW
« no previous file with comments | « no previous file | chrome/plugin/webplugin_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698