Changeset 230203 in webkit
- Timestamp:
- Apr 3, 2018 8:09:10 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r230198 r230203 1 2018-04-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Stop using ResourceHandle to load GResources 4 https://bugs.webkit.org/show_bug.cgi?id=184259 5 6 Reviewed by Sergio Villar Senin. 7 8 GResources are loaded in the WebProcess using ResourceHandle because soup handles them transparently. But now 9 that we no longer use ResourceHandle, we can add a simple loader for GResources, similar to the one used for 10 data URLS, since loading a GResource is a matter of calling g_resources_lookup_data() in the end. 11 12 * SourcesGTK.txt: 13 * SourcesWPE.txt: 14 * loader/ResourceLoader.cpp: 15 (WebCore::ResourceLoader::start): Check if resource to load is a GResource and call loadGResource(). 16 * loader/ResourceLoader.h: 17 * loader/soup/ResourceLoaderSoup.cpp: Added. 18 (WebCore::ResourceLoader::loadGResource): Load the GResource in a GTask thread. 19 * platform/SharedBuffer.cpp: 20 (WebCore::SharedBuffer::DataSegment::data const): 21 (WebCore::SharedBuffer::DataSegment::size const): 22 * platform/SharedBuffer.h: 23 * platform/glib/SharedBufferGlib.cpp: 24 (WebCore::SharedBuffer::SharedBuffer): 25 (WebCore::SharedBuffer::create): 26 1 27 2018-04-02 Carlos Garcia Campos <cgarcia@igalia.com> 2 28 -
trunk/Source/WebCore/SourcesGTK.txt
r230152 r230203 41 41 42 42 editing/atk/FrameSelectionAtk.cpp 43 44 loader/soup/ResourceLoaderSoup.cpp 43 45 44 46 page/linux/ResourceUsageOverlayLinux.cpp -
trunk/Source/WebCore/SourcesWPE.txt
r229169 r230203 26 26 27 27 editing/wpe/EditorWPE.cpp 28 29 loader/soup/ResourceLoaderSoup.cpp 28 30 29 31 page/linux/ResourceUsageOverlayLinux.cpp -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r229959 r230203 214 214 } 215 215 216 #if USE(SOUP) 217 if (m_request.url().protocolIs("resource")) { 218 loadGResource(); 219 return; 220 } 221 #endif 222 216 223 m_handle = ResourceHandle::create(frameLoader()->networkingContext(), m_request, this, m_defersLoading, m_options.sniffContent == SniffContent, m_options.sniffContentEncoding == ContentEncodingSniffingPolicy::Sniff); 217 224 } -
trunk/Source/WebCore/loader/ResourceLoader.h
r229977 r230203 211 211 #endif 212 212 213 #if USE(SOUP) 214 void loadGResource(); 215 #endif 216 213 217 ResourceRequest m_request; 214 218 ResourceRequest m_originalRequest; // Before redirects. -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r225618 r230203 32 32 #include <wtf/unicode/UTF8.h> 33 33 34 #if USE(SOUP)35 #include "GUniquePtrSoup.h"36 #endif37 38 34 namespace WebCore { 39 35 … … 213 209 [](const GUniquePtr<SoupBuffer>& data) { return data->data; }, 214 210 #endif 211 #if USE(GLIB) 212 [](const GRefPtr<GBytes>& data) { return reinterpret_cast<const char*>(g_bytes_get_data(data.get(), nullptr)); }, 213 #endif 215 214 [](const FileSystem::MappedFileData& data) { return reinterpret_cast<const char*>(data.data()); } 216 215 ); … … 233 232 #if USE(SOUP) 234 233 [](const GUniquePtr<SoupBuffer>& data) { return static_cast<size_t>(data->length); }, 234 #endif 235 #if USE(GLIB) 236 [](const GRefPtr<GBytes>& data) { return g_bytes_get_size(data.get()); }, 235 237 #endif 236 238 [](const FileSystem::MappedFileData& data) { return data.size(); } -
trunk/Source/WebCore/platform/SharedBuffer.h
r229776 r230203 44 44 #endif 45 45 46 #if USE(GLIB) 47 #include <wtf/glib/GRefPtr.h> 48 typedef struct _GBytes GBytes; 49 #endif 50 46 51 #if USE(FOUNDATION) 47 52 OBJC_CLASS NSArray; … … 80 85 #endif 81 86 87 #if USE(GLIB) 88 static Ref<SharedBuffer> create(GBytes*); 89 #endif 90 82 91 // Calling data() causes all the data segments to be copied into one segment if they are not already. 83 92 // Iterate the segments using begin() and end() instead. … … 115 124 static Ref<DataSegment> create(GUniquePtr<SoupBuffer>&& data) { return adoptRef(*new DataSegment(WTFMove(data))); } 116 125 #endif 126 #if USE(GLIB) 127 static Ref<DataSegment> create(GRefPtr<GBytes>&& data) { return adoptRef(*new DataSegment(WTFMove(data))); } 128 #endif 117 129 static Ref<DataSegment> create(FileSystem::MappedFileData&& data) { return adoptRef(*new DataSegment(WTFMove(data))); } 118 130 … … 128 140 : m_immutableData(WTFMove(data)) { } 129 141 #endif 142 #if USE(GLIB) 143 DataSegment(GRefPtr<GBytes>&& data) 144 : m_immutableData(WTFMove(data)) { } 145 #endif 130 146 DataSegment(FileSystem::MappedFileData&& data) 131 147 : m_immutableData(WTFMove(data)) { } … … 137 153 #if USE(SOUP) 138 154 GUniquePtr<SoupBuffer>, 155 #endif 156 #if USE(GLIB) 157 GRefPtr<GBytes>, 139 158 #endif 140 159 FileSystem::MappedFileData> m_immutableData; … … 167 186 explicit SharedBuffer(SoupBuffer*); 168 187 #endif 188 #if USE(GLIB) 189 explicit SharedBuffer(GBytes*); 190 #endif 169 191 170 192 void combineIntoOneSegment() const; -
trunk/Source/WebCore/platform/glib/SharedBufferGlib.cpp
r224371 r230203 26 26 #include <glib.h> 27 27 28 namespace WebCore { 28 29 29 namespace WebCore { 30 SharedBuffer::SharedBuffer(GBytes* bytes) 31 { 32 ASSERT(bytes); 33 m_size = g_bytes_get_size(bytes); 34 m_segments.append({ 0, DataSegment::create(GRefPtr<GBytes>(bytes)) }); 35 } 36 37 Ref<SharedBuffer> SharedBuffer::create(GBytes* bytes) 38 { 39 return adoptRef(*new SharedBuffer(bytes)); 40 } 30 41 31 42 RefPtr<SharedBuffer> SharedBuffer::createFromReadingFile(const String& filePath)
Note: See TracChangeset
for help on using the changeset viewer.