Changeset 160378 in webkit
- Timestamp:
- Dec 10, 2013 11:43:10 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160373 r160378 1 2013-12-10 Anders Carlsson <andersca@apple.com> 2 3 More UserData work 4 https://bugs.webkit.org/show_bug.cgi?id=125524 5 6 Reviewed by Dan Bernstein. 7 8 * Shared/APIObject.h: 9 * Shared/UserData.cpp: 10 (WebKit::UserData::transform): 11 New helper function that takes an API::Object and returns a new API::Object with all "sub-objects" (arrays etc) 12 transformed by calling the transformer. 13 14 * Shared/UserData.h: 15 (WebKit::UserData::object): 16 New getter. 17 18 * UIProcess/WebProcessProxy.cpp: 19 (WebKit::WebProcessProxy::apiObjectByConvertingToHandles): 20 Helper function that creates a new API::Object graph by converting WebFrameProxy objects to FrameHandles. 21 22 * WebProcess/WebProcess.cpp: 23 (WebKit::WebProcess::apiObjectByConvertingFromHandles): 24 Helper function that creates a new API::Object graph by converting FrameHandles to WebFrame objects. 25 1 26 2013-12-10 Alberto Garcia <berto@igalia.com> 2 27 -
trunk/Source/WebKit2/Shared/APIObject.h
r160341 r160378 27 27 #define APIObject_h 28 28 29 #include <functional> 29 30 #include <wtf/RefCounted.h> 31 #include <wtf/RefPtr.h> 30 32 31 33 #if PLATFORM(MAC) -
trunk/Source/WebKit2/Shared/UserData.cpp
r160341 r160378 45 45 } 46 46 47 RefPtr<API::Object> UserData::transform(API::Object* object, const std::function<RefPtr<API::Object> (const API::Object&)> transformer) 48 { 49 if (!object) 50 return nullptr; 51 52 if (object->type() == API::Object::Type::Array) { 53 auto& array = static_cast<API::Array&>(*object); 54 55 Vector<RefPtr<API::Object>> elements; 56 elements.reserveInitialCapacity(array.elements().size()); 57 for (const auto& element : array.elements()) 58 elements.uncheckedAppend(transform(element.get(), transformer)); 59 60 return API::Array::create(std::move(elements)); 61 } 62 63 if (auto transformedObject = transformer(*object)) 64 return transformedObject; 65 66 return object; 67 } 68 47 69 void UserData::encode(CoreIPC::ArgumentEncoder& encoder) const 48 70 { -
trunk/Source/WebKit2/Shared/UserData.h
r160341 r160378 46 46 ~UserData(); 47 47 48 static RefPtr<API::Object> transform(API::Object*, const std::function<RefPtr<API::Object> (const API::Object&)> transformer); 49 50 API::Object* object() const { return m_object.get(); } 51 48 52 void encode(CoreIPC::ArgumentEncoder&) const; 49 53 static bool decode(CoreIPC::ArgumentDecoder&, UserData&); -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r160136 r160378 27 27 #include "WebProcessProxy.h" 28 28 29 #include "APIFrameHandle.h" 29 30 #include "CustomProtocolManagerProxyMessages.h" 30 31 #include "DataReference.h" … … 34 35 #include "TextChecker.h" 35 36 #include "TextCheckerState.h" 37 #include "UserData.h" 36 38 #include "WebBackForwardListItem.h" 37 39 #include "WebContext.h" … … 686 688 } 687 689 690 RefPtr<API::Object> WebProcessProxy::apiObjectByConvertingToHandles(API::Object* object) 691 { 692 return UserData::transform(object, [](const API::Object& object) -> RefPtr<API::Object> { 693 switch (object.type()) { 694 case API::Object::Type::Frame: { 695 auto& frame = static_cast<const WebFrameProxy&>(object); 696 return API::FrameHandle::create(frame.frameID()); 697 } 698 699 default: 700 return nullptr; 701 } 702 }); 703 } 704 688 705 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.h
r159982 r160378 127 127 void requestTermination(); 128 128 129 RefPtr<API::Object> apiObjectByConvertingToHandles(API::Object*); 130 129 131 private: 130 132 explicit WebProcessProxy(WebContext&); -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r160308 r160378 27 27 #include "WebProcess.h" 28 28 29 #include "APIFrameHandle.h" 29 30 #include "AuthenticationManager.h" 30 31 #include "EventDispatcher.h" … … 34 35 #include "PluginProcessConnectionManager.h" 35 36 #include "StatisticsData.h" 37 #include "UserData.h" 36 38 #include "WebApplicationCacheManager.h" 37 39 #include "WebConnectionToUIProcess.h" … … 1185 1187 } 1186 1188 1189 RefPtr<API::Object> WebProcess::apiObjectByConvertingFromHandles(API::Object* object) 1190 { 1191 return UserData::transform(object, [this](const API::Object& object) -> RefPtr<API::Object> { 1192 switch (object.type()) { 1193 case API::Object::Type::FrameHandle: { 1194 auto& frameHandle = static_cast<const API::FrameHandle&>(object); 1195 1196 return webFrame(frameHandle.frameID()); 1197 } 1198 1199 default: 1200 return nullptr; 1201 } 1202 }); 1203 } 1204 1187 1205 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r159765 r160378 48 48 #endif 49 49 50 namespace API { 51 class Object; 52 } 53 50 54 namespace WebCore { 51 55 class PageGroup; … … 182 186 #endif // PLATFORM(IOS) 183 187 188 RefPtr<API::Object> apiObjectByConvertingFromHandles(API::Object*); 189 184 190 private: 185 191 WebProcess();
Note: See TracChangeset
for help on using the changeset viewer.