Changeset 102493 in webkit
- Timestamp:
- Dec 9, 2011 5:01:12 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r102488 r102493 1 2011-12-09 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 [Qt] Open shared memory files with shm_open. 4 https://bugs.webkit.org/show_bug.cgi?id=74078 5 6 Original patch by Kimmo Kinnunen 7 8 Reviewed by Kenneth Rohde Christiansen. 9 10 Open shared memory files with shm_open. This uses mount point that is 11 intended to host shared memory files. Typically this is /dev/shm. 12 13 This fixes crashes when filesystem that hosts QDir::temp() is full. 14 15 This is also more well-defined with respect to question whether SHM 16 writes to temp dir would cause unintended wear if hosted on flash drives. 17 18 This also fixes performance problems regarding QDir::temp() and 19 mkostemp(), both of which appear to be long operations. 20 21 * Platform/unix/SharedMemoryUnix.cpp: 22 (WebKit::SharedMemory::create): 23 1 24 2011-12-09 Hugo Parente Lima <hugo.lima@openbossa.org> 2 25 -
trunk/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp
r95901 r102493 106 106 { 107 107 #if PLATFORM(QT) 108 Q String tempName = QDir::temp().filePath(QLatin1String("qwkshm.XXXXXX"));109 QByteArray tempNameCSTR = tempName.toLocal8Bit();108 QByteArray tempNameCSTR("/qwkshm."); 109 tempNameCSTR += QByteArray::number(qrand(), 36); 110 110 char* tempNameC = tempNameCSTR.data(); 111 111 #elif PLATFORM(GTK) … … 115 115 116 116 int fileDescriptor; 117 #if PLATFORM(QT) 118 while ((fileDescriptor = shm_open(tempNameC, O_CREAT | O_CLOEXEC | O_RDWR, S_IRUSR | S_IWUSR)) == -1) { 119 if (errno != EINTR) 120 return 0; 121 } 122 #else 117 123 while ((fileDescriptor = mkstemp(tempNameC)) == -1) { 118 124 if (errno != EINTR) … … 126 132 } 127 133 } 128 134 #endif 129 135 while (ftruncate(fileDescriptor, size) == -1) { 130 136 if (errno != EINTR) { 131 137 while (close(fileDescriptor) == -1 && errno == EINTR) { } 138 #if PLATFORM(QT) 139 shm_unlink(tempNameC); 140 #else 132 141 unlink(tempNameC); 142 #endif 133 143 return 0; 134 144 } … … 138 148 if (data == MAP_FAILED) { 139 149 while (close(fileDescriptor) == -1 && errno == EINTR) { } 150 #if PLATFORM(QT) 151 shm_unlink(tempNameC); 152 #else 140 153 unlink(tempNameC); 154 #endif 141 155 return 0; 142 156 } 143 157 158 #if PLATFORM(QT) 159 shm_unlink(tempNameC); 160 #else 144 161 unlink(tempNameC); 162 #endif 145 163 146 164 RefPtr<SharedMemory> instance = adoptRef(new SharedMemory());
Note: See TracChangeset
for help on using the changeset viewer.