Title: [201941] trunk
Revision
201941
Author
[email protected]
Date
2016-06-10 14:26:00 -0700 (Fri, 10 Jun 2016)

Log Message

Introduce WTF::UniqueRef
https://bugs.webkit.org/show_bug.cgi?id=158596

Reviewed by Brady Eidson.

Source/WebCore:

No new tests.  No change in behavior.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::overlayPage):
* loader/EmptyClients.cpp:
(WebCore::fillWithEmptyClients):
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::canStartMedia):
(WebCore::Page::editorClient):
(WebCore::Page::plugInClient):
(WebCore::Page::mainFrame):
(WebCore::Page::groupPtr): Deleted.
* page/PageConfiguration.cpp:
(WebCore::PageConfiguration::PageConfiguration):
* page/PageConfiguration.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):

Source/WebKit/win:

* WebView.cpp:
(WebView::initWithFrame):

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldDispatchFakeMouseMoveEvents):

Source/WTF:

WTF::UniqueRef is like a std::unique_ptr that is guaranteed to be non-null.
std::make_unique returns a non-null value that is put into a std::unique_ptr, a type
that could contain null values.  To be able to pass such values around and store them
without wondering if they are null, we now have WTF::UniqueRef which cannot be null.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/UniqueRef.h: Added.
(WTF::makeUniqueRef):
(WTF::UniqueRef::UniqueRef):
(WTF::UniqueRef::get):
(WTF::UniqueRef::operator&):
(WTF::UniqueRef::operator->):

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/UniqueRef.cpp: Added.
(TestWebKitAPI::B::B):
(TestWebKitAPI::C::C):
(TestWebKitAPI::function):
(TestWebKitAPI::TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (201940 => 201941)


--- trunk/Source/WTF/ChangeLog	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WTF/ChangeLog	2016-06-10 21:26:00 UTC (rev 201941)
@@ -1,3 +1,24 @@
+2016-06-10  Alex Christensen  <[email protected]>
+
+        Introduce WTF::UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=158596
+
+        Reviewed by Brady Eidson.
+
+        WTF::UniqueRef is like a std::unique_ptr that is guaranteed to be non-null.
+        std::make_unique returns a non-null value that is put into a std::unique_ptr, a type
+        that could contain null values.  To be able to pass such values around and store them
+        without wondering if they are null, we now have WTF::UniqueRef which cannot be null.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/UniqueRef.h: Added.
+        (WTF::makeUniqueRef):
+        (WTF::UniqueRef::UniqueRef):
+        (WTF::UniqueRef::get):
+        (WTF::UniqueRef::operator&):
+        (WTF::UniqueRef::operator->):
+
 2016-06-09  Brady Eidson  <[email protected]>
 
         Unaddressed review feedback from r201872

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (201940 => 201941)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2016-06-10 21:26:00 UTC (rev 201941)
@@ -106,6 +106,7 @@
 		515F79501CFC9F4A00CCED93 /* CrossThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 515F794D1CFC9F4A00CCED93 /* CrossThreadTask.h */; };
 		515F79561CFD3A6900CCED93 /* CrossThreadQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 515F79551CFD3A6900CCED93 /* CrossThreadQueue.h */; };
 		553071CA1C40427200384898 /* TinyLRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 553071C91C40427200384898 /* TinyLRUCache.h */; };
+		5C7C88D41D0A3A0A009D2F6D /* UniqueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */; };
 		70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70A993FC1AD7151300FA615B /* SymbolRegistry.cpp */; };
 		70A993FF1AD7151300FA615B /* SymbolRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A993FD1AD7151300FA615B /* SymbolRegistry.h */; };
 		70ECA60D1B02426800449739 /* AtomicStringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70ECA60A1B02426800449739 /* AtomicStringImpl.cpp */; };
@@ -430,6 +431,7 @@
 		515F794D1CFC9F4A00CCED93 /* CrossThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadTask.h; sourceTree = "<group>"; };
 		515F79551CFD3A6900CCED93 /* CrossThreadQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadQueue.h; sourceTree = "<group>"; };
 		553071C91C40427200384898 /* TinyLRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TinyLRUCache.h; sourceTree = "<group>"; };
+		5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueRef.h; sourceTree = "<group>"; };
 		5D247B6214689B8600E78B76 /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		5D247B6E14689C4700E78B76 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
 		5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
@@ -770,6 +772,7 @@
 		A876DBD6151816E500DADB95 /* wtf */ = {
 			isa = PBXGroup;
 			children = (
+				5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */,
 				2CDED0F018115C3F004DBA70 /* cf */,
 				E4A0AD3B1A96251900536DF6 /* cocoa */,
 				A8A47281151A825A004123FF /* dtoa */,
@@ -1171,6 +1174,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				A8A47385151A825B004123FF /* ASCIICType.h in Headers */,
+				5C7C88D41D0A3A0A009D2F6D /* UniqueRef.h in Headers */,
 				A8A47434151A825B004123FF /* ASCIIFastPath.h in Headers */,
 				A8A47387151A825B004123FF /* Assertions.h in Headers */,
 				A8A47388151A825B004123FF /* Atomics.h in Headers */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (201940 => 201941)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2016-06-10 21:26:00 UTC (rev 201941)
@@ -111,6 +111,7 @@
     Threading.h
     ThreadingPrimitives.h
     TinyPtrSet.h
+    UniqueRef.h
     VMTags.h
     ValueCheck.h
     Vector.h

Added: trunk/Source/WTF/wtf/UniqueRef.h (0 => 201941)


--- trunk/Source/WTF/wtf/UniqueRef.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/UniqueRef.h	2016-06-10 21:26:00 UTC (rev 201941)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <memory>
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+template<typename T> class UniqueRef;
+
+template<typename T, class... Args>
+UniqueRef<T> makeUniqueRef(Args&&... args)
+{
+    return UniqueRef<T>(*new T(std::forward<Args>(args)...));
+}
+
+template<typename T>
+class UniqueRef {
+public:
+    template <typename U>
+    UniqueRef(UniqueRef<U>&& other)
+        : m_ref(WTFMove(other.m_ref))
+    {
+        ASSERT(m_ref);
+    }
+
+    T& get() { ASSERT(m_ref); return *m_ref; }
+    const T& get() const { ASSERT(m_ref); return *m_ref; }
+
+    T* operator&() { ASSERT(m_ref); return m_ref.get(); }
+    const T* operator&() const { ASSERT(m_ref); return m_ref.get(); }
+
+    T* operator->() { ASSERT(m_ref); return m_ref.get(); }
+    const T* operator->() const { ASSERT(m_ref); return m_ref.get(); }
+
+private:
+    template<class U, class... Args> friend UniqueRef<U> makeUniqueRef(Args&&...);
+    template<class U> friend class UniqueRef;
+
+    UniqueRef(T& other)
+        : m_ref(&other)
+    {
+        ASSERT(m_ref);
+    }
+
+    std::unique_ptr<T> m_ref;
+};
+
+} // namespace WTF
+
+using WTF::UniqueRef;
+using WTF::makeUniqueRef;

Modified: trunk/Source/WebCore/ChangeLog (201940 => 201941)


--- trunk/Source/WebCore/ChangeLog	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/ChangeLog	2016-06-10 21:26:00 UTC (rev 201941)
@@ -1,3 +1,30 @@
+2016-06-10  Alex Christensen  <[email protected]>
+
+        Introduce WTF::UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=158596
+
+        Reviewed by Brady Eidson.
+
+        No new tests.  No change in behavior.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::overlayPage):
+        * loader/EmptyClients.cpp:
+        (WebCore::fillWithEmptyClients):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        * page/Page.h:
+        (WebCore::Page::canStartMedia):
+        (WebCore::Page::editorClient):
+        (WebCore::Page::plugInClient):
+        (WebCore::Page::mainFrame):
+        (WebCore::Page::groupPtr): Deleted.
+        * page/PageConfiguration.cpp:
+        (WebCore::PageConfiguration::PageConfiguration):
+        * page/PageConfiguration.h:
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::dataChanged):
+
 2016-06-10  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Cleanup InspectorIndexedDBAgent a bit

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (201940 => 201941)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -864,7 +864,7 @@
     if (m_overlayPage)
         return m_overlayPage.get();
 
-    PageConfiguration pageConfiguration;
+    PageConfiguration pageConfiguration(makeUniqueRef<EmptyEditorClient>());
     fillWithEmptyClients(pageConfiguration);
     m_overlayPage = std::make_unique<Page>(WTFMove(pageConfiguration));
 

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (201940 => 201941)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -129,8 +129,6 @@
     pageConfiguration.dragClient = &dummyDragClient.get();
 #endif
 
-    pageConfiguration.editorClient = std::make_unique<EmptyEditorClient>();
-    
     static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient;
     pageConfiguration.inspectorClient = &dummyInspectorClient.get();
 

Modified: trunk/Source/WebCore/page/Page.cpp (201940 => 201941)


--- trunk/Source/WebCore/page/Page.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/page/Page.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -238,7 +238,6 @@
     , m_sessionID(SessionID::defaultSessionID())
     , m_isClosing(false)
 {
-    ASSERT(m_editorClient);
     updateTimerThrottlingState();
 
     m_storageNamespaceProvider->addPage(*this);

Modified: trunk/Source/WebCore/page/Page.h (201940 => 201941)


--- trunk/Source/WebCore/page/Page.h	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/page/Page.h	2016-06-10 21:26:00 UTC (rev 201941)
@@ -44,6 +44,7 @@
 #include <wtf/Optional.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
+#include <wtf/UniqueRef.h>
 #include <wtf/text/WTFString.h>
 
 #if OS(SOLARIS)
@@ -157,7 +158,7 @@
     WEBCORE_EXPORT void setCanStartMedia(bool);
     bool canStartMedia() const { return m_canStartMedia; }
 
-    EditorClient& editorClient() const { return *m_editorClient; }
+    EditorClient& editorClient() { return m_editorClient.get(); }
     PlugInClient* plugInClient() const { return m_plugInClient; }
 
     MainFrame& mainFrame() { return m_mainFrame.get(); }
@@ -174,7 +175,6 @@
     WEBCORE_EXPORT const String& groupName() const;
 
     PageGroup& group();
-    PageGroup* groupPtr() { return m_group; } // can return 0
 
     static void forEachPage(std::function<void(Page&)>);
 
@@ -583,7 +583,7 @@
 
     RefPtr<RenderTheme> m_theme;
 
-    std::unique_ptr<EditorClient> m_editorClient;
+    UniqueRef<EditorClient> m_editorClient;
     PlugInClient* m_plugInClient;
     ValidationMessageClient* m_validationMessageClient;
     std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;

Modified: trunk/Source/WebCore/page/PageConfiguration.cpp (201940 => 201941)


--- trunk/Source/WebCore/page/PageConfiguration.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/page/PageConfiguration.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -37,7 +37,8 @@
 
 namespace WebCore {
 
-PageConfiguration::PageConfiguration()
+PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient)
+    : editorClient(WTFMove(editorClient))
 {
 }
 

Modified: trunk/Source/WebCore/page/PageConfiguration.h (201940 => 201941)


--- trunk/Source/WebCore/page/PageConfiguration.h	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/page/PageConfiguration.h	2016-06-10 21:26:00 UTC (rev 201941)
@@ -23,11 +23,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef PageConfiguration_h
-#define PageConfiguration_h
+#pragma once
 
 #include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
+#include <wtf/UniqueRef.h>
 
 #if USE(APPLE_INTERNAL_SDK)
 #include <WebKitAdditions/PageConfigurationIncludes.h>
@@ -59,7 +59,7 @@
 class PageConfiguration {
     WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED;
 public:
-    WEBCORE_EXPORT PageConfiguration();
+    WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&);
     WEBCORE_EXPORT ~PageConfiguration();
 
     AlternativeTextClient* alternativeTextClient { nullptr };
@@ -67,7 +67,7 @@
 #if ENABLE(CONTEXT_MENUS)
     ContextMenuClient* contextMenuClient { nullptr };
 #endif
-    std::unique_ptr<EditorClient> editorClient;
+    UniqueRef<EditorClient> editorClient;
     DragClient* dragClient { nullptr };
     InspectorClient* inspectorClient { nullptr };
     PlugInClient* plugInClient { nullptr };
@@ -89,5 +89,3 @@
 };
 
 }
-
-#endif

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (201940 => 201941)


--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -379,7 +379,7 @@
         return true;
 
     if (allDataReceived) {
-        PageConfiguration pageConfiguration;
+        PageConfiguration pageConfiguration(makeUniqueRef<EmptyEditorClient>());
         fillWithEmptyClients(pageConfiguration);
         m_chromeClient = std::make_unique<SVGImageChromeClient>(this);
         pageConfiguration.chromeClient = m_chromeClient.get();

Modified: trunk/Source/WebKit/mac/ChangeLog (201940 => 201941)


--- trunk/Source/WebKit/mac/ChangeLog	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-06-10 21:26:00 UTC (rev 201941)
@@ -1,3 +1,14 @@
+2016-06-10  Alex Christensen  <[email protected]>
+
+        Introduce WTF::UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=158596
+
+        Reviewed by Brady Eidson.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
 2016-06-09  Alex Christensen  <[email protected]>
 
         Clean up EditorClient lifetime

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (201940 => 201941)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2016-06-10 21:26:00 UTC (rev 201941)
@@ -987,7 +987,7 @@
     _private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath);
     _private->group->addWebView(self);
 
-    PageConfiguration pageConfiguration;
+    PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(self));
 #if !PLATFORM(IOS)
     pageConfiguration.chromeClient = new WebChromeClient(self);
     pageConfiguration.contextMenuClient = new WebContextMenuClient(self);
@@ -1004,7 +1004,6 @@
 #import <WebKitAdditions/WebViewInitialization.mm>
 #endif
 
-    pageConfiguration.editorClient = std::make_unique<WebEditorClient>(self);
     pageConfiguration.alternativeTextClient = new WebAlternativeTextClient(self);
     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
@@ -1238,7 +1237,7 @@
     _private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath);
     _private->group->addWebView(self);
 
-    PageConfiguration pageConfiguration;
+    PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(self));
     pageConfiguration.chromeClient = new WebChromeClientIOS(self);
 #if ENABLE(DRAG_SUPPORT)
     pageConfiguration.dragClient = new WebDragClient(self);
@@ -1248,7 +1247,6 @@
 #import <WebKitAdditions/WebViewInitialization.mm>
 #endif
 
-    pageConfiguration.editorClient = std::make_unique<WebEditorClient>(self);
     pageConfiguration.inspectorClient = new WebInspectorClient(self);
     pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);

Modified: trunk/Source/WebKit/win/ChangeLog (201940 => 201941)


--- trunk/Source/WebKit/win/ChangeLog	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebKit/win/ChangeLog	2016-06-10 21:26:00 UTC (rev 201941)
@@ -1,3 +1,13 @@
+2016-06-10  Alex Christensen  <[email protected]>
+
+        Introduce WTF::UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=158596
+
+        Reviewed by Brady Eidson.
+
+        * WebView.cpp:
+        (WebView::initWithFrame):
+
 2016-06-09  Alex Christensen  <[email protected]>
 
         Fix Windows build.

Modified: trunk/Source/WebKit/win/WebView.cpp (201940 => 201941)


--- trunk/Source/WebKit/win/WebView.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebKit/win/WebView.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -164,6 +164,7 @@
 #include <bindings/ScriptValue.h>
 #include <wtf/MainThread.h>
 #include <wtf/RAMSize.h>
+#include <wtf/UniqueRef.h>
 
 #if USE(CG)
 #include <CoreGraphics/CGContext.h>
@@ -2908,10 +2909,9 @@
 
     m_inspectorClient = new WebInspectorClient(this);
 
-    PageConfiguration configuration;
+    PageConfiguration configuration(makeUniqueRef<WebEditorClient>(this));
     configuration.chromeClient = new WebChromeClient(this);
     configuration.contextMenuClient = new WebContextMenuClient(this);
-    configuration.editorClient = std::make_unique<WebEditorClient>(this);
     configuration.dragClient = new WebDragClient(this);
     configuration.inspectorClient = m_inspectorClient;
     configuration.loaderClientForMainFrame = new WebFrameLoaderClient;

Modified: trunk/Source/WebKit2/ChangeLog (201940 => 201941)


--- trunk/Source/WebKit2/ChangeLog	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-10 21:26:00 UTC (rev 201941)
@@ -1,3 +1,13 @@
+2016-06-10  Alex Christensen  <[email protected]>
+
+        Introduce WTF::UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=158596
+
+        Reviewed by Brady Eidson.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_shouldDispatchFakeMouseMoveEvents):
+
 2016-06-10  Anders Carlsson  <[email protected]>
 
         Remove CommandLine class

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (201940 => 201941)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -384,12 +384,11 @@
     Settings::setShouldManageAudioSessionCategory(true);
 #endif
 
-    PageConfiguration pageConfiguration;
+    PageConfiguration pageConfiguration(makeUniqueRef<WebEditorClient>(this));
     pageConfiguration.chromeClient = new WebChromeClient(this);
 #if ENABLE(CONTEXT_MENUS)
     pageConfiguration.contextMenuClient = new WebContextMenuClient(this);
 #endif
-    pageConfiguration.editorClient = std::make_unique<WebEditorClient>(this);
 #if ENABLE(DRAG_SUPPORT)
     pageConfiguration.dragClient = new WebDragClient(this);
 #endif

Modified: trunk/Tools/ChangeLog (201940 => 201941)


--- trunk/Tools/ChangeLog	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Tools/ChangeLog	2016-06-10 21:26:00 UTC (rev 201941)
@@ -1,3 +1,18 @@
+2016-06-10  Alex Christensen  <[email protected]>
+
+        Introduce WTF::UniqueRef
+        https://bugs.webkit.org/show_bug.cgi?id=158596
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/UniqueRef.cpp: Added.
+        (TestWebKitAPI::B::B):
+        (TestWebKitAPI::C::C):
+        (TestWebKitAPI::function):
+        (TestWebKitAPI::TEST):
+
 2016-06-10  Sam Weinig  <[email protected]>
 
         Refactor TestWebKitAPI to allow just testing WTF

Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (201940 => 201941)


--- trunk/Tools/TestWebKitAPI/CMakeLists.txt	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt	2016-06-10 21:26:00 UTC (rev 201941)
@@ -75,6 +75,7 @@
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/UniqueRef.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/WeakPtr.cpp

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201940 => 201941)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-06-10 21:01:55 UTC (rev 201940)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-06-10 21:26:00 UTC (rev 201941)
@@ -731,6 +731,7 @@
 		5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLNotChange.mm; sourceTree = "<group>"; };
 		57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = "<group>"; };
 		57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IsNavigationActionTrusted.html; sourceTree = "<group>"; };
+		5C5E633D1D0B67940085A025 /* UniqueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueRef.cpp; sourceTree = "<group>"; };
 		7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheAddImageToCacheIOS.mm; sourceTree = "<group>"; };
 		75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EphemeralSessionPushStateNoHistoryCallback.cpp; sourceTree = "<group>"; };
 		764322D51B61CCA40024F801 /* WordBoundaryTypingAttributes.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WordBoundaryTypingAttributes.mm; sourceTree = "<group>"; };
@@ -1431,6 +1432,7 @@
 		BC9096461255618900083756 /* WTF */ = {
 			isa = PBXGroup;
 			children = (
+				5C5E633D1D0B67940085A025 /* UniqueRef.cpp */,
 				C0991C4F143C7D68007998F2 /* cf */,
 				7CBBA07519BB8A0900BBF025 /* darwin */,
 				BC029B1A1486B23800817DA9 /* ns */,

Added: trunk/Tools/TestWebKitAPI/Tests/WTF/UniqueRef.cpp (0 => 201941)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/UniqueRef.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/UniqueRef.cpp	2016-06-10 21:26:00 UTC (rev 201941)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <wtf/UniqueRef.h>
+#include <wtf/Vector.h>
+
+namespace TestWebKitAPI {
+    
+class A { };
+class B {
+public:
+    B(int a, int b, int c)
+        : a(a)
+        , b(b)
+        , c(c)
+    { };
+    int a;
+    int b;
+    int c;
+};
+class C {
+public:
+    C(UniqueRef<A>&& a)
+        : a(WTFMove(a))
+    { }
+    UniqueRef<A> a;
+};
+class D : public A { };
+
+void function(const UniqueRef<A> a)
+{
+    const A& b = a.get();
+    const A* c = &a;
+    UNUSED_PARAM(b);
+    UNUSED_PARAM(c);
+}
+
+TEST(WTF, UniqueRef)
+{
+    UniqueRef<A> a = makeUniqueRef<A>();
+    UniqueRef<B> b = makeUniqueRef<B>(1, 2, 3);
+    B& c = b.get();
+    const B& d = b.get();
+    B* e = &b;
+    const B* f = &b;
+    UniqueRef<A> j = WTFMove(a);
+    
+    Vector<UniqueRef<B>> v;
+    v.append(makeUniqueRef<B>(4, 5, 6));
+    v.append(makeUniqueRef<B>(7, 8, 9));
+    UniqueRef<B> g = v.takeLast();
+    ASSERT_EQ(g->b, 8);
+    ASSERT_EQ(v.last()->b, 5);
+    
+    C h(makeUniqueRef<A>());
+    C i(makeUniqueRef<D>());
+    
+    UNUSED_PARAM(a);
+    UNUSED_PARAM(b);
+    UNUSED_PARAM(c);
+    UNUSED_PARAM(d);
+    UNUSED_PARAM(e);
+    UNUSED_PARAM(f);
+    UNUSED_PARAM(g);
+    UNUSED_PARAM(h);
+    UNUSED_PARAM(i);
+    UNUSED_PARAM(j);
+}
+
+} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to