Changeset 203954 in webkit
- Timestamp:
- Jul 31, 2016 1:31:14 AM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r203944 r203954 1 2016-07-31 Adrian Perez de Castro <aperez@igalia.com> 2 3 [GTK][Unix] Implement missing WebKit::SharedMemory::create() function 4 https://bugs.webkit.org/show_bug.cgi?id=160364 5 6 Reviewed by Carlos Garcia Campos. 7 8 The WebKit::SharedMemory::create() function is missing for the Unix 9 platform, which is also used by the GTK+ port. The latter is going 10 to need this in place to use the common content filtering code. 11 12 * Platform/unix/SharedMemoryUnix.cpp: 13 (WebKit::accessModeMMap): Added helper function to convert a 14 SharedMemory::Protection value into flags useable with mmap(). 15 (WebKit::SharedMemory::create): Added. Implementation reuses code 16 existing in the SharedMemory::allocate() function. 17 (WebKit::SharedMemory::allocate): Reimplemented in terms of 18 SharedMemory::create(). 19 1 20 2016-07-30 Dan Bernstein <mitz@apple.com> 2 21 -
trunk/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp
r203155 r203954 94 94 } 95 95 96 RefPtr<SharedMemory> SharedMemory::allocate(size_t size) 96 static inline int accessModeMMap(SharedMemory::Protection protection) 97 { 98 switch (protection) { 99 case SharedMemory::Protection::ReadOnly: 100 return PROT_READ; 101 case SharedMemory::Protection::ReadWrite: 102 return PROT_READ | PROT_WRITE; 103 } 104 105 ASSERT_NOT_REACHED(); 106 return PROT_READ | PROT_WRITE; 107 } 108 109 RefPtr<SharedMemory> SharedMemory::create(void* address, size_t size, Protection protection) 97 110 { 98 111 CString tempName; … … 120 133 } 121 134 122 void* data = mmap( 0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileDescriptor, 0);135 void* data = mmap(address, size, accessModeMMap(protection), MAP_SHARED, fileDescriptor, 0); 123 136 if (data == MAP_FAILED) { 124 137 closeWithRetry(fileDescriptor); … … 136 149 } 137 150 138 static inline int accessModeMMap(SharedMemory::Protection protection) 139 { 140 switch (protection) { 141 case SharedMemory::Protection::ReadOnly: 142 return PROT_READ; 143 case SharedMemory::Protection::ReadWrite: 144 return PROT_READ | PROT_WRITE; 145 } 146 147 ASSERT_NOT_REACHED(); 148 return PROT_READ | PROT_WRITE; 151 RefPtr<SharedMemory> SharedMemory::allocate(size_t size) 152 { 153 return SharedMemory::create(nullptr, size, SharedMemory::Protection::ReadWrite); 149 154 } 150 155
Note: See TracChangeset
for help on using the changeset viewer.