| Differences between
and this patch
- a/Source/WTF/ChangeLog +22 lines
Lines 1-3 a/Source/WTF/ChangeLog_sec1
1
2015-04-24  Darin Adler  <darin@apple.com>
2
3
        Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
4
        https://bugs.webkit.org/show_bug.cgi?id=128007
5
6
        Reviewed by Anders Carlsson.
7
8
        * WTF.vcxproj/WTF.vcxproj: Removed OwnPtr source files.
9
        * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
10
        * WTF.xcodeproj/project.pbxproj: Ditto.
11
        * wtf/CMakeLists.txt: Ditto.
12
13
        * wtf/Forward.h: Removed OwnPtr and PassOwnPtr.
14
        * wtf/HashTraits.h: Ditto.
15
16
        * wtf/OwnPtr.h: Removed.
17
        * wtf/OwnPtrCommon.h: Removed.
18
        * wtf/PassOwnPtr.h: Removed.
19
20
        * wtf/SizeLimits.cpp: Removed OwnPtr.
21
        * wtf/VectorTraits.h: Removed OwnPtr specialization.
22
1
2015-04-23  Jer Noble  <jer.noble@apple.com>
23
2015-04-23  Jer Noble  <jer.noble@apple.com>
2
24
3
        Disable HAVE_AVKIT on AppleTV
25
        Disable HAVE_AVKIT on AppleTV
- a/Source/WebCore/ChangeLog +91 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2015-04-24  Darin Adler  <darin@apple.com>
2
3
        Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
4
        https://bugs.webkit.org/show_bug.cgi?id=128007
5
6
        Reviewed by Anders Carlsson.
7
8
        * PlatformEfl.cmake: Removed OwnPtrCairo source files.
9
        * PlatformGTK.cmake: Ditto.
10
        * PlatformWinCairo.cmake: Ditto.
11
        * WebCore.vcxproj/WebCore.vcxproj: Ditto.
12
        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
13
14
        * platform/CrossThreadCopier.cpp: Removed OwnPtr specialization.
15
        * platform/CrossThreadCopier.h: Ditto.
16
17
        * platform/ScrollAnimatorNone.cpp: Removed unneeded include.
18
        * platform/ThreadGlobalData.cpp: Ditto.
19
        * platform/ThreadGlobalData.h: Ditto.
20
        * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: Ditto.
21
22
        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
23
        (WebCore::AVFWrapper::processNotification): Use unique_ptr.
24
        (WebCore::AVFWrapper::notificationCallback): Use make_unique.
25
        (WebCore::AVFWrapper::platformLayer): Ditto.
26
27
        * platform/graphics/cairo/CairoUtilities.cpp:
28
        (WebCore::appendPathToCairoContext): Use cairo_path_destroy directly
29
        instead of a smart pointer; the code path is simple enough that it is
30
        clear this way.
31
32
        * platform/graphics/cairo/ImageBufferCairo.cpp:
33
        (WebCore::ImageBuffer::ImageBuffer): Use make_unique.
34
        * platform/graphics/cairo/ImageBufferDataCairo.h: Use unique_ptr.
35
36
        * platform/graphics/cairo/OwnPtrCairo.cpp: Removed.
37
        * platform/graphics/cairo/OwnPtrCairo.h: Removed.
38
39
        * platform/graphics/cairo/PathCairo.cpp:
40
        (WebCore::Path::Path): Use cairo_path_destroy directly instead of a
41
        smart pointer; the code path is simple enough that it is clear this way.
42
        (WebCore::Path::operator=): Ditto.
43
        (WebCore::Path::addPath): Ditto.
44
        (WebCore::Path::apply): Ditto.
45
        * platform/graphics/cairo/PlatformContextCairo.cpp:
46
        (WebCore::PlatformContextCairo::clipForPatternFilling): Ditto.
47
48
        * platform/graphics/freetype/FontCacheFreeType.cpp: Removed unneeded include.
49
        * platform/graphics/glx/GLContextGLX.cpp: Ditto.
50
51
        * platform/graphics/surfaces/egl/EGLSurface.cpp:
52
        (WebCore::EGLOffScreenSurface::EGLOffScreenSurface): Use make_unique.
53
54
        * platform/graphics/surfaces/glx/GLXConfigSelector.h:
55
        (WebCore::GLXConfigSelector::findMatchingConfig): Use unique_ptr with X11Deleter.
56
        (WebCore::GLXConfigSelector::findMatchingConfigWithVisualId): Ditto.
57
        * platform/graphics/surfaces/glx/GLXSurface.cpp:
58
        (WebCore::GLXTransportSurface::GLXTransportSurface): Ditto.
59
        (WebCore::GLXOffScreenSurface::initialize): Ditto.
60
61
        * platform/graphics/surfaces/glx/OwnPtrX11.h: Removed.
62
63
        * platform/graphics/surfaces/glx/X11Helper.cpp:
64
        (WebCore::X11Helper::createOffScreenWindow): Use unique_ptr with X11Deleter.
65
        (WebCore::X11Helper::createPixmap): Ditto.
66
67
        * platform/graphics/surfaces/glx/X11Helper.h: Added X11Deleter,
68
        which can be used with unique_ptr to make it call XFree instead of delete.
69
70
        * platform/graphics/win/FullScreenController.cpp: Use unique_ptr.
71
        (FullScreenController::FullScreenController): Use make_unique.
72
        (FullScreenController::enterFullScreen): Ditto.
73
        * platform/graphics/win/FullScreenController.h: Use unique_ptr.
74
75
        * platform/graphics/win/GraphicsContext3DWin.cpp: Removed unneeded includes.
76
77
        * platform/graphics/win/WKCAImageQueue.cpp:
78
        (WebCore::WKCAImageQueue::WKCAImageQueue): Use make_unique.
79
        * platform/graphics/win/WKCAImageQueue.h: Use unique_ptr.
80
81
        * platform/network/NetworkStorageSessionStub.cpp: Removed unneeded include.
82
83
        * platform/network/ResourceHandleInternal.h: Use unique_ptr.
84
85
        * platform/network/curl/MultipartHandle.cpp:
86
        (WebCore::MultipartHandle::create): Deleted.
87
        * platform/network/curl/MultipartHandle.h: Deleted the create function.
88
89
        * platform/network/curl/ResourceHandleManager.cpp:
90
        (WebCore::headerCallback): Use make_unique.
91
1
2015-04-24  Per Arne Vollan  <peavo@outlook.com>
92
2015-04-24  Per Arne Vollan  <peavo@outlook.com>
2
93
3
        [Win] Popup menu is not accessible.
94
        [Win] Popup menu is not accessible.
- a/Source/WebKit2/ChangeLog +10 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2015-04-24  Darin Adler  <darin@apple.com>
2
3
        Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
4
        https://bugs.webkit.org/show_bug.cgi?id=128007
5
6
        Reviewed by Anders Carlsson.
7
8
        * NetworkProcess/cache/NetworkCacheEncoder.h: Added an include now
9
        needed that was inherited from OwnPtr.h before.
10
1
2015-04-24  Antti Koivisto  <antti@apple.com>
11
2015-04-24  Antti Koivisto  <antti@apple.com>
2
12
3
        Network Cache: Make path functions members
13
        Network Cache: Make path functions members
- a/Source/WTF/WTF.vcxproj/WTF.vcxproj -3 lines
Lines 237-244 a/Source/WTF/WTF.vcxproj/WTF.vcxproj_sec1
237
    <ClInclude Include="..\wtf\Noncopyable.h" />
237
    <ClInclude Include="..\wtf\Noncopyable.h" />
238
    <ClInclude Include="..\wtf\NumberOfCores.h" />
238
    <ClInclude Include="..\wtf\NumberOfCores.h" />
239
    <ClInclude Include="..\wtf\OSRandomSource.h" />
239
    <ClInclude Include="..\wtf\OSRandomSource.h" />
240
    <ClInclude Include="..\wtf\OwnPtr.h" />
241
    <ClInclude Include="..\wtf\OwnPtrCommon.h" />
242
    <ClInclude Include="..\wtf\PackedIntVector.h" />
240
    <ClInclude Include="..\wtf\PackedIntVector.h" />
243
    <ClInclude Include="..\wtf\PageAllocation.h" />
241
    <ClInclude Include="..\wtf\PageAllocation.h" />
244
    <ClInclude Include="..\wtf\PageBlock.h" />
242
    <ClInclude Include="..\wtf\PageBlock.h" />
Lines 247-253 a/Source/WTF/WTF.vcxproj/WTF.vcxproj_sec2
247
    <ClInclude Include="..\wtf\ParallelJobsGeneric.h" />
245
    <ClInclude Include="..\wtf\ParallelJobsGeneric.h" />
248
    <ClInclude Include="..\wtf\ParallelJobsLibdispatch.h" />
246
    <ClInclude Include="..\wtf\ParallelJobsLibdispatch.h" />
249
    <ClInclude Include="..\wtf\ParallelJobsOpenMP.h" />
247
    <ClInclude Include="..\wtf\ParallelJobsOpenMP.h" />
250
    <ClInclude Include="..\wtf\PassOwnPtr.h" />
251
    <ClInclude Include="..\wtf\PassRefPtr.h" />
248
    <ClInclude Include="..\wtf\PassRefPtr.h" />
252
    <ClInclude Include="..\wtf\Platform.h" />
249
    <ClInclude Include="..\wtf\Platform.h" />
253
    <ClInclude Include="..\wtf\PrintStream.h" />
250
    <ClInclude Include="..\wtf\PrintStream.h" />
- a/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters -9 lines
Lines 528-539 a/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters_sec1
528
    <ClInclude Include="..\wtf\OSRandomSource.h">
528
    <ClInclude Include="..\wtf\OSRandomSource.h">
529
      <Filter>wtf</Filter>
529
      <Filter>wtf</Filter>
530
    </ClInclude>
530
    </ClInclude>
531
    <ClInclude Include="..\wtf\OwnPtr.h">
532
      <Filter>wtf</Filter>
533
    </ClInclude>
534
    <ClInclude Include="..\wtf\OwnPtrCommon.h">
535
      <Filter>wtf</Filter>
536
    </ClInclude>
537
    <ClInclude Include="..\wtf\PackedIntVector.h">
531
    <ClInclude Include="..\wtf\PackedIntVector.h">
538
      <Filter>wtf</Filter>
532
      <Filter>wtf</Filter>
539
    </ClInclude>
533
    </ClInclude>
Lines 558-566 a/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters_sec2
558
    <ClInclude Include="..\wtf\ParallelJobsOpenMP.h">
552
    <ClInclude Include="..\wtf\ParallelJobsOpenMP.h">
559
      <Filter>wtf</Filter>
553
      <Filter>wtf</Filter>
560
    </ClInclude>
554
    </ClInclude>
561
    <ClInclude Include="..\wtf\PassOwnPtr.h">
562
      <Filter>wtf</Filter>
563
    </ClInclude>
564
    <ClInclude Include="..\wtf\PassRefPtr.h">
555
    <ClInclude Include="..\wtf\PassRefPtr.h">
565
      <Filter>wtf</Filter>
556
      <Filter>wtf</Filter>
566
    </ClInclude>
557
    </ClInclude>
- a/Source/WTF/WTF.xcodeproj/project.pbxproj -12 lines
Lines 185-192 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec1
185
		A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */; };
185
		A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */; };
186
		A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472DA151A825B004123FF /* OSRandomSource.cpp */; };
186
		A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472DA151A825B004123FF /* OSRandomSource.cpp */; };
187
		A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DB151A825B004123FF /* OSRandomSource.h */; };
187
		A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DB151A825B004123FF /* OSRandomSource.h */; };
188
		A8A473FC151A825B004123FF /* OwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DD151A825B004123FF /* OwnPtr.h */; };
189
		A8A473FD151A825B004123FF /* OwnPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DE151A825B004123FF /* OwnPtrCommon.h */; };
190
		A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DF151A825B004123FF /* PackedIntVector.h */; };
188
		A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DF151A825B004123FF /* PackedIntVector.h */; };
191
		A8A473FF151A825B004123FF /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E0151A825B004123FF /* PageAllocation.h */; };
189
		A8A473FF151A825B004123FF /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E0151A825B004123FF /* PageAllocation.h */; };
192
		A8A47402151A825B004123FF /* PageBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472E3151A825B004123FF /* PageBlock.cpp */; };
190
		A8A47402151A825B004123FF /* PageBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472E3151A825B004123FF /* PageBlock.cpp */; };
Lines 194-200 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec2
194
		A8A47404151A825B004123FF /* PageReservation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E5151A825B004123FF /* PageReservation.h */; };
192
		A8A47404151A825B004123FF /* PageReservation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E5151A825B004123FF /* PageReservation.h */; };
195
		A8A47405151A825B004123FF /* ParallelJobs.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E6151A825B004123FF /* ParallelJobs.h */; };
193
		A8A47405151A825B004123FF /* ParallelJobs.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E6151A825B004123FF /* ParallelJobs.h */; };
196
		A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */; };
194
		A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */; };
197
		A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472EC151A825B004123FF /* PassOwnPtr.h */; };
198
		A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472ED151A825B004123FF /* PassRefPtr.h */; };
195
		A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472ED151A825B004123FF /* PassRefPtr.h */; };
199
		A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472FB151A825B004123FF /* RandomNumber.cpp */; };
196
		A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472FB151A825B004123FF /* RandomNumber.cpp */; };
200
		A8A47415151A825B004123FF /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FC151A825B004123FF /* RandomNumber.h */; };
197
		A8A47415151A825B004123FF /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FC151A825B004123FF /* RandomNumber.h */; };
Lines 476-483 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec3
476
		A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; };
473
		A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; };
477
		A8A472DA151A825B004123FF /* OSRandomSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSRandomSource.cpp; sourceTree = "<group>"; };
474
		A8A472DA151A825B004123FF /* OSRandomSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSRandomSource.cpp; sourceTree = "<group>"; };
478
		A8A472DB151A825B004123FF /* OSRandomSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSRandomSource.h; sourceTree = "<group>"; };
475
		A8A472DB151A825B004123FF /* OSRandomSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSRandomSource.h; sourceTree = "<group>"; };
479
		A8A472DD151A825B004123FF /* OwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtr.h; sourceTree = "<group>"; };
480
		A8A472DE151A825B004123FF /* OwnPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtrCommon.h; sourceTree = "<group>"; };
481
		A8A472DF151A825B004123FF /* PackedIntVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackedIntVector.h; sourceTree = "<group>"; };
476
		A8A472DF151A825B004123FF /* PackedIntVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackedIntVector.h; sourceTree = "<group>"; };
482
		A8A472E0151A825B004123FF /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
477
		A8A472E0151A825B004123FF /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
483
		A8A472E3151A825B004123FF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; };
478
		A8A472E3151A825B004123FF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; };
Lines 485-491 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec4
485
		A8A472E5151A825B004123FF /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
480
		A8A472E5151A825B004123FF /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
486
		A8A472E6151A825B004123FF /* ParallelJobs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobs.h; sourceTree = "<group>"; };
481
		A8A472E6151A825B004123FF /* ParallelJobs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobs.h; sourceTree = "<group>"; };
487
		A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobsLibdispatch.h; sourceTree = "<group>"; };
482
		A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobsLibdispatch.h; sourceTree = "<group>"; };
488
		A8A472EC151A825B004123FF /* PassOwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnPtr.h; sourceTree = "<group>"; };
489
		A8A472ED151A825B004123FF /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; };
483
		A8A472ED151A825B004123FF /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; };
490
		A8A472FB151A825B004123FF /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
484
		A8A472FB151A825B004123FF /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
491
		A8A472FC151A825B004123FF /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
485
		A8A472FC151A825B004123FF /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
Lines 795-802 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec5
795
				A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
789
				A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
796
				A8A472DB151A825B004123FF /* OSRandomSource.h */,
790
				A8A472DB151A825B004123FF /* OSRandomSource.h */,
797
				1AFDE6521953B23D00C48FFA /* Optional.h */,
791
				1AFDE6521953B23D00C48FFA /* Optional.h */,
798
				A8A472DD151A825B004123FF /* OwnPtr.h */,
799
				A8A472DE151A825B004123FF /* OwnPtrCommon.h */,
800
				A8A472DF151A825B004123FF /* PackedIntVector.h */,
792
				A8A472DF151A825B004123FF /* PackedIntVector.h */,
801
				A8A472E0151A825B004123FF /* PageAllocation.h */,
793
				A8A472E0151A825B004123FF /* PageAllocation.h */,
802
				A8A472E3151A825B004123FF /* PageBlock.cpp */,
794
				A8A472E3151A825B004123FF /* PageBlock.cpp */,
Lines 804-810 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec6
804
				A8A472E5151A825B004123FF /* PageReservation.h */,
796
				A8A472E5151A825B004123FF /* PageReservation.h */,
805
				A8A472E6151A825B004123FF /* ParallelJobs.h */,
797
				A8A472E6151A825B004123FF /* ParallelJobs.h */,
806
				A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */,
798
				A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */,
807
				A8A472EC151A825B004123FF /* PassOwnPtr.h */,
808
				A8A472ED151A825B004123FF /* PassRefPtr.h */,
799
				A8A472ED151A825B004123FF /* PassRefPtr.h */,
809
				A876DBD7151816E500DADB95 /* Platform.h */,
800
				A876DBD7151816E500DADB95 /* Platform.h */,
810
				0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
801
				0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
Lines 1131-1138 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec7
1131
				7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */,
1122
				7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */,
1132
				A8A473F6151A825B004123FF /* OSAllocator.h in Headers */,
1123
				A8A473F6151A825B004123FF /* OSAllocator.h in Headers */,
1133
				A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */,
1124
				A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */,
1134
				A8A473FC151A825B004123FF /* OwnPtr.h in Headers */,
1135
				A8A473FD151A825B004123FF /* OwnPtrCommon.h in Headers */,
1136
				0FB14E1B1810E1DC009B6B4D /* BagToHashMap.h in Headers */,
1125
				0FB14E1B1810E1DC009B6B4D /* BagToHashMap.h in Headers */,
1137
				A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */,
1126
				A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */,
1138
				A8A473FF151A825B004123FF /* PageAllocation.h in Headers */,
1127
				A8A473FF151A825B004123FF /* PageAllocation.h in Headers */,
Lines 1140-1146 a/Source/WTF/WTF.xcodeproj/project.pbxproj_sec8
1140
				A8A47404151A825B004123FF /* PageReservation.h in Headers */,
1129
				A8A47404151A825B004123FF /* PageReservation.h in Headers */,
1141
				A8A47405151A825B004123FF /* ParallelJobs.h in Headers */,
1130
				A8A47405151A825B004123FF /* ParallelJobs.h in Headers */,
1142
				A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */,
1131
				A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */,
1143
				A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */,
1144
				A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
1132
				A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
1145
				A876DBD8151816E500DADB95 /* Platform.h in Headers */,
1133
				A876DBD8151816E500DADB95 /* Platform.h in Headers */,
1146
				0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
1134
				0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
- a/Source/WTF/wtf/CMakeLists.txt -3 lines
Lines 55-62 set(WTF_HEADERS a/Source/WTF/wtf/CMakeLists.txt_sec1
55
    NumberOfCores.h
55
    NumberOfCores.h
56
    OSAllocator.h
56
    OSAllocator.h
57
    OSRandomSource.h
57
    OSRandomSource.h
58
    OwnPtr.h
59
    OwnPtrCommon.h
60
    PageAllocation.h
58
    PageAllocation.h
61
    PageBlock.h
59
    PageBlock.h
62
    PageReservation.h
60
    PageReservation.h
Lines 64-70 set(WTF_HEADERS a/Source/WTF/wtf/CMakeLists.txt_sec2
64
    ParallelJobsGeneric.h
62
    ParallelJobsGeneric.h
65
    ParallelJobsLibdispatch.h
63
    ParallelJobsLibdispatch.h
66
    ParallelJobsOpenMP.h
64
    ParallelJobsOpenMP.h
67
    PassOwnPtr.h
68
    PassRefPtr.h
65
    PassRefPtr.h
69
    Platform.h
66
    Platform.h
70
    PrintStream.h
67
    PrintStream.h
- a/Source/WTF/wtf/Forward.h -4 lines
Lines 28-35 namespace WTF { a/Source/WTF/wtf/Forward.h_sec1
28
template<typename T> class Function;
28
template<typename T> class Function;
29
template<typename T> class LazyNeverDestroyed;
29
template<typename T> class LazyNeverDestroyed;
30
template<typename T> class NeverDestroyed;
30
template<typename T> class NeverDestroyed;
31
template<typename T> class OwnPtr;
32
template<typename T> class PassOwnPtr;
33
template<typename T> class PassRefPtr;
31
template<typename T> class PassRefPtr;
34
template<typename T> class RefPtr;
32
template<typename T> class RefPtr;
35
template<typename T> class Ref;
33
template<typename T> class Ref;
Lines 65-72 using WTF::FunctionDispatcher; a/Source/WTF/wtf/Forward.h_sec2
65
using WTF::LazyNeverDestroyed;
63
using WTF::LazyNeverDestroyed;
66
using WTF::NeverDestroyed;
64
using WTF::NeverDestroyed;
67
using WTF::OrdinalNumber;
65
using WTF::OrdinalNumber;
68
using WTF::OwnPtr;
69
using WTF::PassOwnPtr;
70
using WTF::PassRefPtr;
66
using WTF::PassRefPtr;
71
using WTF::PrintStream;
67
using WTF::PrintStream;
72
using WTF::Ref;
68
using WTF::Ref;
- a/Source/WTF/wtf/HashTraits.h -12 / +1 lines
Lines 30-37 namespace WTF { a/Source/WTF/wtf/HashTraits.h_sec1
30
30
31
class String;
31
class String;
32
32
33
template<typename T> class OwnPtr;
34
35
template<typename T> struct HashTraits;
33
template<typename T> struct HashTraits;
36
34
37
template<bool isInteger, typename T> struct GenericHashTraitsBase;
35
template<bool isInteger, typename T> struct GenericHashTraitsBase;
Lines 120-136 template<typename T, typename Deleter> struct HashTraits<std::unique_ptr<T, Dele a/Source/WTF/wtf/HashTraits.h_sec2
120
    static T* peek(std::nullptr_t) { return nullptr; }
118
    static T* peek(std::nullptr_t) { return nullptr; }
121
};
119
};
122
120
123
template<typename T> struct HashTraits<OwnPtr<T>> : SimpleClassHashTraits<OwnPtr<T>> {
124
    typedef std::nullptr_t EmptyValueType;
125
    static EmptyValueType emptyValue() { return nullptr; }
126
127
    typedef T* PeekType;
128
    static T* peek(const OwnPtr<T>& value) { return value.get(); }
129
    static T* peek(std::nullptr_t) { return nullptr; }
130
};
131
132
template<typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPtr<P>> {
121
template<typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPtr<P>> {
133
    static P* emptyValue() { return 0; }
122
    static P* emptyValue() { return nullptr; }
134
123
135
    typedef P* PeekType;
124
    typedef P* PeekType;
136
    static PeekType peek(const RefPtr<P>& value) { return value.get(); }
125
    static PeekType peek(const RefPtr<P>& value) { return value.get(); }
- a/Source/WTF/wtf/OwnPtr.h -230 lines
Lines 1-230 a/Source/WTF/wtf/OwnPtr.h_sec1
1
/*
2
 *  Copyright (C) 2006, 2007, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
3
 *
4
 *  This library is free software; you can redistribute it and/or
5
 *  modify it under the terms of the GNU Library General Public
6
 *  License as published by the Free Software Foundation; either
7
 *  version 2 of the License, or (at your option) any later version.
8
 *
9
 *  This library is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 *  Library General Public License for more details.
13
 *
14
 *  You should have received a copy of the GNU Library General Public License
15
 *  along with this library; see the file COPYING.LIB.  If not, write to
16
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 *  Boston, MA 02110-1301, USA.
18
 *
19
 */
20
21
#ifndef WTF_OwnPtr_h
22
#define WTF_OwnPtr_h
23
24
#include <algorithm>
25
#include <cstddef>
26
#include <memory>
27
#include <wtf/Assertions.h>
28
#include <wtf/Atomics.h>
29
#include <wtf/GetPtr.h>
30
#include <wtf/HashTraits.h>
31
#include <wtf/Noncopyable.h>
32
#include <wtf/OwnPtrCommon.h>
33
34
namespace WTF {
35
36
    template<typename T> class PassOwnPtr;
37
    template<typename T> PassOwnPtr<T> adoptPtr(T*);
38
39
    template<typename T> class OwnPtr {
40
    public:
41
        typedef T ValueType;
42
        typedef ValueType* PtrType;
43
44
        OwnPtr() : m_ptr(0) { }
45
        OwnPtr(std::nullptr_t) : m_ptr(0) { }
46
47
        // See comment in PassOwnPtr.h for why this takes a const reference.
48
        template<typename U> OwnPtr(const PassOwnPtr<U>& o);
49
50
        ~OwnPtr() { deleteOwnedPtr(m_ptr); }
51
52
        PtrType get() const { return m_ptr; }
53
54
        void clear();
55
        PassOwnPtr<T> release();
56
        PtrType leakPtr() WARN_UNUSED_RETURN;
57
58
        ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
59
        PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
60
61
        bool operator!() const { return !m_ptr; }
62
63
        // This conversion operator allows implicit conversion to bool but not to other integer types.
64
        typedef PtrType OwnPtr::*UnspecifiedBoolType;
65
        operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtr::m_ptr : 0; }
66
67
        OwnPtr& operator=(const PassOwnPtr<T>&);
68
        OwnPtr& operator=(std::nullptr_t) { clear(); return *this; }
69
        template<typename U> OwnPtr& operator=(const PassOwnPtr<U>&);
70
71
        OwnPtr(OwnPtr&&);
72
        template<typename U> OwnPtr(OwnPtr<U>&&);
73
74
        OwnPtr& operator=(OwnPtr&&);
75
        template<typename U> OwnPtr& operator=(OwnPtr<U>&&);
76
77
        // Hash table deleted values, which are only constructed and never copied or destroyed.
78
        OwnPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
79
        bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
80
81
        void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
82
        
83
        // Construct an object to store into this OwnPtr, but only so long as this OwnPtr
84
        // doesn't already point to an object. This will ensure that after you call this,
85
        // the OwnPtr will point to an instance of T, even if called concurrently. This
86
        // instance may or may not have been created by this call. Moreover, this call uses
87
        // an opportunistic transaction, in that we may create an instance of T and then
88
        // immediately throw it away, if in the process of creating that instance some
89
        // other thread was doing the same thing and stored its instance into this pointer
90
        // before we had a chance to do so.
91
        template<typename... Args>
92
        void createTransactionally(Args...);
93
94
    private:
95
        explicit OwnPtr(PtrType ptr) : m_ptr(ptr) { }
96
97
        static PtrType hashTableDeletedValue() { return reinterpret_cast<PtrType>(-1); }
98
99
        // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
100
        // double-destruction), so these equality operators should never be needed.
101
        template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
102
        template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
103
        template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
104
        template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
105
106
        PtrType m_ptr;
107
    };
108
109
    template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(const PassOwnPtr<U>& o)
110
        : m_ptr(o.leakPtr())
111
    {
112
    }
113
114
    template<typename T> inline void OwnPtr<T>::clear()
115
    {
116
        deleteOwnedPtr(std::exchange(m_ptr, nullptr));
117
    }
118
119
    template<typename T> inline PassOwnPtr<T> OwnPtr<T>::release()
120
    {
121
        return adoptPtr(std::exchange(m_ptr, nullptr));
122
    }
123
124
    template<typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr()
125
    {
126
        return std::exchange(m_ptr, nullptr);
127
    }
128
129
    template<typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<T>& o)
130
    {
131
        PtrType ptr = std::exchange(m_ptr, o.leakPtr());
132
        ASSERT(!ptr || m_ptr != ptr);
133
        deleteOwnedPtr(ptr);
134
        return *this;
135
    }
136
137
    template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<U>& o)
138
    {
139
        PtrType ptr = std::exchange(m_ptr, o.leakPtr());
140
        ASSERT(!ptr || m_ptr != ptr);
141
        deleteOwnedPtr(ptr);
142
        return *this;
143
    }
144
145
    template<typename T> inline OwnPtr<T>::OwnPtr(OwnPtr<T>&& o)
146
        : m_ptr(o.leakPtr())
147
    {
148
    }
149
150
    template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(OwnPtr<U>&& o)
151
        : m_ptr(o.leakPtr())
152
    {
153
    }
154
155
    template<typename T> inline auto OwnPtr<T>::operator=(OwnPtr&& o) -> OwnPtr&
156
    {
157
        ASSERT(!o || o != m_ptr);
158
        OwnPtr ptr = WTF::move(o);
159
        swap(ptr);
160
        return *this;
161
    }
162
163
    template<typename T> template<typename U> inline auto OwnPtr<T>::operator=(OwnPtr<U>&& o) -> OwnPtr&
164
    {
165
        ASSERT(!o || o != m_ptr);
166
        OwnPtr ptr = WTF::move(o);
167
        swap(ptr);
168
        return *this;
169
    }
170
171
    template<typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b)
172
    {
173
        a.swap(b);
174
    }
175
176
    template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, U* b)
177
    {
178
        return a.get() == b; 
179
    }
180
181
    template<typename T, typename U> inline bool operator==(T* a, const OwnPtr<U>& b) 
182
    {
183
        return a == b.get(); 
184
    }
185
186
    template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, U* b)
187
    {
188
        return a.get() != b; 
189
    }
190
191
    template<typename T, typename U> inline bool operator!=(T* a, const OwnPtr<U>& b)
192
    {
193
        return a != b.get(); 
194
    }
195
196
    template<typename T> template<typename... Args> inline void OwnPtr<T>::createTransactionally(Args... args)
197
    {
198
        if (m_ptr) {
199
            WTF::loadLoadFence();
200
            return;
201
        }
202
        
203
        T* newObject = new T(args...);
204
        WTF::storeStoreFence();
205
#if ENABLE(COMPARE_AND_SWAP)
206
        do {
207
            if (m_ptr) {
208
                delete newObject;
209
                WTF::loadLoadFence();
210
                return;
211
            }
212
        } while (!WTF::weakCompareAndSwap(bitwise_cast<void*volatile*>(&m_ptr), nullptr, newObject));
213
#else
214
        m_ptr = newObject;
215
#endif
216
    }
217
218
    template <typename T> struct IsSmartPtr<OwnPtr<T>> {
219
        static const bool value = true;
220
    };
221
222
    template<typename P> struct DefaultHash<OwnPtr<P>> {
223
        typedef PtrHash<OwnPtr<P>> Hash;
224
    };
225
226
} // namespace WTF
227
228
using WTF::OwnPtr;
229
230
#endif // WTF_OwnPtr_h
- a/Source/WTF/wtf/OwnPtrCommon.h -42 lines
Lines 1-42 a/Source/WTF/wtf/OwnPtrCommon.h_sec1
1
/*
2
 * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
3
 * Copyright (C) 2009 Torch Mobile, Inc.
4
 * Copyright (C) 2010 Company 100 Inc.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
19
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
26
 */
27
28
#ifndef WTF_OwnPtrCommon_h
29
#define WTF_OwnPtrCommon_h
30
31
namespace WTF {
32
33
    template <typename T> inline void deleteOwnedPtr(T* ptr)
34
    {
35
        typedef char known[sizeof(T) ? 1 : -1];
36
        if (sizeof(known))
37
            delete ptr;
38
    }
39
40
} // namespace WTF
41
42
#endif // WTF_OwnPtrCommon_h
- a/Source/WTF/wtf/PassOwnPtr.h -168 lines
Lines 1-168 a/Source/WTF/wtf/PassOwnPtr.h_sec1
1
/*
2
 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 */
25
26
#ifndef WTF_PassOwnPtr_h
27
#define WTF_PassOwnPtr_h
28
29
#include <cstddef>
30
#include <wtf/Assertions.h>
31
#include <wtf/GetPtr.h>
32
#include <wtf/OwnPtrCommon.h>
33
#include <type_traits>
34
35
namespace WTF {
36
37
    template<typename T> class OwnPtr;
38
    template<typename T> class PassOwnPtr;
39
    template<typename T> PassOwnPtr<T> adoptPtr(T*);
40
41
    class RefCountedBase;
42
    class ThreadSafeRefCountedBase;
43
44
    template<typename T> class PassOwnPtr {
45
    public:
46
        typedef T ValueType;
47
        typedef ValueType* PtrType;
48
49
        PassOwnPtr() : m_ptr(0) { }
50
        PassOwnPtr(std::nullptr_t) : m_ptr(0) { }
51
52
        // It somewhat breaks the type system to allow transfer of ownership out of
53
        // a const PassOwnPtr. However, it makes it much easier to work with PassOwnPtr
54
        // temporaries, and we don't have a need to use real const PassOwnPtrs anyway.
55
        PassOwnPtr(const PassOwnPtr& o) : m_ptr(o.leakPtr()) { }
56
        template<typename U> PassOwnPtr(const PassOwnPtr<U>& o) : m_ptr(o.leakPtr()) { }
57
58
        ~PassOwnPtr() { deleteOwnedPtr(m_ptr); }
59
60
        PtrType get() const { return m_ptr; }
61
62
        PtrType leakPtr() const WARN_UNUSED_RETURN;
63
64
        ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
65
        PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
66
67
        bool operator!() const { return !m_ptr; }
68
69
        // This conversion operator allows implicit conversion to bool but not to other integer types.
70
        typedef PtrType PassOwnPtr::*UnspecifiedBoolType;
71
        operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnPtr::m_ptr : 0; }
72
73
        PassOwnPtr& operator=(const PassOwnPtr&) { COMPILE_ASSERT(!sizeof(T*), PassOwnPtr_should_never_be_assigned_to); return *this; }
74
75
        template<typename U> friend PassOwnPtr<U> adoptPtr(U*);
76
77
    private:
78
        explicit PassOwnPtr(PtrType ptr) : m_ptr(ptr) { }
79
80
        // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
81
        // double-destruction), so these equality operators should never be needed.
82
        template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
83
        template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
84
        template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
85
        template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
86
87
        mutable PtrType m_ptr;
88
    };
89
90
    template<typename T> inline typename PassOwnPtr<T>::PtrType PassOwnPtr<T>::leakPtr() const
91
    {
92
        return std::exchange(m_ptr, nullptr);
93
    }
94
95
    template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b) 
96
    {
97
        return a.get() == b.get(); 
98
    }
99
100
    template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const OwnPtr<U>& b) 
101
    {
102
        return a.get() == b.get(); 
103
    }
104
    
105
    template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, const PassOwnPtr<U>& b) 
106
    {
107
        return a.get() == b.get(); 
108
    }
109
    
110
    template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, U* b) 
111
    {
112
        return a.get() == b; 
113
    }
114
    
115
    template<typename T, typename U> inline bool operator==(T* a, const PassOwnPtr<U>& b) 
116
    {
117
        return a == b.get(); 
118
    }
119
    
120
    template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b) 
121
    {
122
        return a.get() != b.get(); 
123
    }
124
    
125
    template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const OwnPtr<U>& b) 
126
    {
127
        return a.get() != b.get(); 
128
    }
129
    
130
    template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, const PassOwnPtr<U>& b) 
131
    {
132
        return a.get() != b.get(); 
133
    }
134
    
135
    template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, U* b)
136
    {
137
        return a.get() != b; 
138
    }
139
    
140
    template<typename T, typename U> inline bool operator!=(T* a, const PassOwnPtr<U>& b) 
141
    {
142
        return a != b.get(); 
143
    }
144
145
    template<typename T> inline PassOwnPtr<T> adoptPtr(T* ptr)
146
    {
147
        static_assert(!std::is_convertible<T*, RefCountedBase*>::value, "Do not use adoptPtr with RefCounted, use adoptRef!");
148
        static_assert(!std::is_convertible<T*, ThreadSafeRefCountedBase*>::value, "Do not use adoptPtr with ThreadSafeRefCounted, use adoptRef!");
149
150
        return PassOwnPtr<T>(ptr);
151
    }
152
153
    template<typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(const PassOwnPtr<U>& p) 
154
    {
155
        return adoptPtr(static_cast<T*>(p.leakPtr()));
156
    }
157
158
    template <typename T> struct IsSmartPtr<PassOwnPtr<T>> {
159
        static const bool value = true;
160
    };
161
162
} // namespace WTF
163
164
using WTF::PassOwnPtr;
165
using WTF::adoptPtr;
166
using WTF::static_pointer_cast;
167
168
#endif // WTF_PassOwnPtr_h
- a/Source/WTF/wtf/SizeLimits.cpp -2 lines
Lines 33-39 a/Source/WTF/wtf/SizeLimits.cpp_sec1
33
#include <type_traits>
33
#include <type_traits>
34
#include <utility>
34
#include <utility>
35
#include <wtf/Assertions.h>
35
#include <wtf/Assertions.h>
36
#include <wtf/OwnPtr.h>
37
#include <wtf/PassRefPtr.h>
36
#include <wtf/PassRefPtr.h>
38
#include <wtf/RefCounted.h>
37
#include <wtf/RefCounted.h>
39
#include <wtf/RefPtr.h>
38
#include <wtf/RefPtr.h>
Lines 55-61 struct SameSizeAsRefCounted { a/Source/WTF/wtf/SizeLimits.cpp_sec2
55
};
54
};
56
#endif
55
#endif
57
56
58
static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small!");
59
static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small!");
57
static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small!");
60
static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!");
58
static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!");
61
static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small!");
59
static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small!");
- a/Source/WTF/wtf/VectorTraits.h -16 / +6 lines
Lines 21-27 a/Source/WTF/wtf/VectorTraits.h_sec1
21
#ifndef WTF_VectorTraits_h
21
#ifndef WTF_VectorTraits_h
22
#define WTF_VectorTraits_h
22
#define WTF_VectorTraits_h
23
23
24
#include <wtf/OwnPtr.h>
25
#include <wtf/Ref.h>
24
#include <wtf/Ref.h>
26
#include <wtf/RefPtr.h>
25
#include <wtf/RefPtr.h>
27
#include <utility>
26
#include <utility>
Lines 66-87 namespace WTF { a/Source/WTF/wtf/VectorTraits.h_sec2
66
        static const bool canCompareWithMemcmp = true;
65
        static const bool canCompareWithMemcmp = true;
67
    };
66
    };
68
67
69
    // We know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy
68
    // We know smart pointers are simple enough that initializing to 0 and moving with memcpy
70
    // (and then not destructing the original) will totally work
69
    // (and then not destructing the original) will work.
71
    template<typename P>
72
    struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { };
73
70
74
    template<typename P>
71
    template<typename P> struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { };
75
    struct VectorTraits<OwnPtr<P>> : SimpleClassVectorTraits { };
72
    template<typename P> struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits { };
76
73
    template<typename P> struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { };
77
    template<typename P>
74
    template<> struct VectorTraits<AtomicString> : SimpleClassVectorTraits { };
78
    struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits { };
79
80
    template<typename P>
81
    struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { };
82
83
    template<>
84
    struct VectorTraits<AtomicString> : SimpleClassVectorTraits { };
85
75
86
    template<typename First, typename Second>
76
    template<typename First, typename Second>
87
    struct VectorTraits<std::pair<First, Second>>
77
    struct VectorTraits<std::pair<First, Second>>
- a/Source/WebCore/PlatformEfl.cmake -1 lines
Lines 119-125 list(APPEND WebCore_SOURCES a/Source/WebCore/PlatformEfl.cmake_sec1
119
    platform/graphics/cairo/ImageBufferCairo.cpp
119
    platform/graphics/cairo/ImageBufferCairo.cpp
120
    platform/graphics/cairo/ImageCairo.cpp
120
    platform/graphics/cairo/ImageCairo.cpp
121
    platform/graphics/cairo/IntRectCairo.cpp
121
    platform/graphics/cairo/IntRectCairo.cpp
122
    platform/graphics/cairo/OwnPtrCairo.cpp
123
    platform/graphics/cairo/PathCairo.cpp
122
    platform/graphics/cairo/PathCairo.cpp
124
    platform/graphics/cairo/PatternCairo.cpp
123
    platform/graphics/cairo/PatternCairo.cpp
125
    platform/graphics/cairo/PlatformContextCairo.cpp
124
    platform/graphics/cairo/PlatformContextCairo.cpp
- a/Source/WebCore/PlatformGTK.cmake -1 lines
Lines 78-84 list(APPEND WebCore_SOURCES a/Source/WebCore/PlatformGTK.cmake_sec1
78
    platform/graphics/cairo/ImageBufferCairo.cpp
78
    platform/graphics/cairo/ImageBufferCairo.cpp
79
    platform/graphics/cairo/ImageCairo.cpp
79
    platform/graphics/cairo/ImageCairo.cpp
80
    platform/graphics/cairo/IntRectCairo.cpp
80
    platform/graphics/cairo/IntRectCairo.cpp
81
    platform/graphics/cairo/OwnPtrCairo.cpp
82
    platform/graphics/cairo/PathCairo.cpp
81
    platform/graphics/cairo/PathCairo.cpp
83
    platform/graphics/cairo/PatternCairo.cpp
82
    platform/graphics/cairo/PatternCairo.cpp
84
    platform/graphics/cairo/PlatformContextCairo.cpp
83
    platform/graphics/cairo/PlatformContextCairo.cpp
- a/Source/WebCore/PlatformWinCairo.cmake -1 lines
Lines 50-56 list(APPEND WebCore_SOURCES a/Source/WebCore/PlatformWinCairo.cmake_sec1
50
    platform/graphics/cairo/ImageBufferCairo.cpp
50
    platform/graphics/cairo/ImageBufferCairo.cpp
51
    platform/graphics/cairo/ImageCairo.cpp
51
    platform/graphics/cairo/ImageCairo.cpp
52
    platform/graphics/cairo/IntRectCairo.cpp
52
    platform/graphics/cairo/IntRectCairo.cpp
53
    platform/graphics/cairo/OwnPtrCairo.cpp
54
    platform/graphics/cairo/PathCairo.cpp
53
    platform/graphics/cairo/PathCairo.cpp
55
    platform/graphics/cairo/PatternCairo.cpp
54
    platform/graphics/cairo/PatternCairo.cpp
56
    platform/graphics/cairo/PlatformContextCairo.cpp
55
    platform/graphics/cairo/PlatformContextCairo.cpp
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj -20 lines
Lines 8582-8597 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec1
8582
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
8582
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
8583
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
8583
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
8584
    </ClCompile>
8584
    </ClCompile>
8585
    <ClCompile Include="..\platform\graphics\cairo\OwnPtrCairo.cpp">
8586
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
8587
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
8588
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
8589
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
8590
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
8591
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
8592
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
8593
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
8594
    </ClCompile>
8595
    <ClCompile Include="..\platform\graphics\cairo\PathCairo.cpp">
8585
    <ClCompile Include="..\platform\graphics\cairo\PathCairo.cpp">
8596
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
8586
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
8597
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
8587
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Lines 20118-20133 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj_sec2
20118
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
20108
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
20119
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
20109
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
20120
    </CustomBuildStep>
20110
    </CustomBuildStep>
20121
    <CustomBuildStep Include="..\platform\graphics\cairo\OwnPtrCairo.h">
20122
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
20123
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
20124
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
20125
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
20126
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
20127
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
20128
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
20129
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
20130
    </CustomBuildStep>
20131
    <CustomBuildStep Include="..\platform\graphics\cairo\PlatformPathCairo.h">
20111
    <CustomBuildStep Include="..\platform\graphics\cairo\PlatformPathCairo.h">
20132
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
20112
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
20133
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
20113
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
- a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters -6 lines
Lines 1584-1592 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters_sec1
1584
    <ClCompile Include="..\platform\graphics\cairo\IntRectCairo.cpp">
1584
    <ClCompile Include="..\platform\graphics\cairo\IntRectCairo.cpp">
1585
      <Filter>platform\graphics\cairo</Filter>
1585
      <Filter>platform\graphics\cairo</Filter>
1586
    </ClCompile>
1586
    </ClCompile>
1587
    <ClCompile Include="..\platform\graphics\cairo\OwnPtrCairo.cpp">
1588
      <Filter>platform\graphics\cairo</Filter>
1589
    </ClCompile>
1590
    <ClCompile Include="..\platform\graphics\cairo\PathCairo.cpp">
1587
    <ClCompile Include="..\platform\graphics\cairo\PathCairo.cpp">
1591
      <Filter>platform\graphics\cairo</Filter>
1588
      <Filter>platform\graphics\cairo</Filter>
1592
    </ClCompile>
1589
    </ClCompile>
Lines 15371-15379 a/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters_sec2
15371
    <CustomBuildStep Include="..\platform\graphics\cairo\GraphicsContextPlatformPrivateCairo.h">
15368
    <CustomBuildStep Include="..\platform\graphics\cairo\GraphicsContextPlatformPrivateCairo.h">
15372
      <Filter>platform\graphics\cairo</Filter>
15369
      <Filter>platform\graphics\cairo</Filter>
15373
    </CustomBuildStep>
15370
    </CustomBuildStep>
15374
    <CustomBuildStep Include="..\platform\graphics\cairo\OwnPtrCairo.h">
15375
      <Filter>platform\graphics\cairo</Filter>
15376
    </CustomBuildStep>
15377
    <CustomBuildStep Include="..\platform\graphics\cairo\PlatformPathCairo.h">
15371
    <CustomBuildStep Include="..\platform\graphics\cairo\PlatformPathCairo.h">
15378
      <Filter>platform\graphics\cairo</Filter>
15372
      <Filter>platform\graphics\cairo</Filter>
15379
    </CustomBuildStep>
15373
    </CustomBuildStep>
- a/Source/WebCore/platform/CrossThreadCopier.cpp -14 lines
Lines 179-196 COMPILE_ASSERT((std::is_same< a/Source/WebCore/platform/CrossThreadCopier.cpp_sec1
179
                  >::value),
179
                  >::value),
180
               RawPointerRefCountedTest);
180
               RawPointerRefCountedTest);
181
181
182
// Verify that PassOwnPtr gets passed through.
183
COMPILE_ASSERT((std::is_same<
184
                  PassOwnPtr<float>,
185
                  CrossThreadCopier<PassOwnPtr<float>>::Type
186
                  >::value),
187
               PassOwnPtrTest);
188
189
// Verify that PassOwnPtr does not get passed through.
190
COMPILE_ASSERT((std::is_same<
191
                  int,
192
                  CrossThreadCopier<OwnPtr<float>>::Type
193
                  >::value),
194
               OwnPtrTest);
195
196
} // namespace WebCore
182
} // namespace WebCore
- a/Source/WebCore/platform/CrossThreadCopier.h -9 lines
Lines 33-39 a/Source/WebCore/platform/CrossThreadCopier.h_sec1
33
33
34
#include <wtf/Assertions.h>
34
#include <wtf/Assertions.h>
35
#include <wtf/Forward.h>
35
#include <wtf/Forward.h>
36
#include <wtf/PassOwnPtr.h>
37
#include <wtf/PassRefPtr.h>
36
#include <wtf/PassRefPtr.h>
38
#include <wtf/RefPtr.h>
37
#include <wtf/RefPtr.h>
39
#include <wtf/Threading.h>
38
#include <wtf/Threading.h>
Lines 110-123 namespace WebCore { a/Source/WebCore/platform/CrossThreadCopier.h_sec2
110
        }
109
        }
111
    };
110
    };
112
111
113
    template<typename T> struct CrossThreadCopierBase<false, false, PassOwnPtr<T>> {
114
        typedef PassOwnPtr<T> Type;
115
        static Type copy(Type ownPtr)
116
        {
117
            return ownPtr;
118
        }
119
    };
120
121
    template<> struct CrossThreadCopierBase<false, false, URL> {
112
    template<> struct CrossThreadCopierBase<false, false, URL> {
122
        typedef URL Type;
113
        typedef URL Type;
123
        static Type copy(const URL&);
114
        static Type copy(const URL&);
- a/Source/WebCore/platform/ScrollAnimatorNone.cpp -1 lines
Lines 41-47 a/Source/WebCore/platform/ScrollAnimatorNone.cpp_sec1
41
#include "ScrollbarTheme.h"
41
#include "ScrollbarTheme.h"
42
#include <algorithm>
42
#include <algorithm>
43
#include <wtf/CurrentTime.h>
43
#include <wtf/CurrentTime.h>
44
#include <wtf/PassOwnPtr.h>
45
44
46
using namespace std;
45
using namespace std;
47
46
- a/Source/WebCore/platform/ThreadGlobalData.cpp -1 lines
Lines 32-38 a/Source/WebCore/platform/ThreadGlobalData.cpp_sec1
32
#include "TextCodecICU.h"
32
#include "TextCodecICU.h"
33
#include "ThreadTimers.h"
33
#include "ThreadTimers.h"
34
#include <wtf/MainThread.h>
34
#include <wtf/MainThread.h>
35
#include <wtf/PassOwnPtr.h>
36
#include <wtf/ThreadSpecific.h>
35
#include <wtf/ThreadSpecific.h>
37
#include <wtf/Threading.h>
36
#include <wtf/Threading.h>
38
#include <wtf/WTFThreadData.h>
37
#include <wtf/WTFThreadData.h>
- a/Source/WebCore/platform/ThreadGlobalData.h -1 lines
Lines 30-36 a/Source/WebCore/platform/ThreadGlobalData.h_sec1
30
#include <wtf/HashMap.h>
30
#include <wtf/HashMap.h>
31
#include <wtf/HashSet.h>
31
#include <wtf/HashSet.h>
32
#include <wtf/Noncopyable.h>
32
#include <wtf/Noncopyable.h>
33
#include <wtf/OwnPtr.h>
34
#include <wtf/text/StringHash.h>
33
#include <wtf/text/StringHash.h>
35
34
36
#include <wtf/ThreadSpecific.h>
35
#include <wtf/ThreadSpecific.h>
- a/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h -1 lines
Lines 27-33 a/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h_sec1
27
#define CDMSessionAVFoundationCF_h
27
#define CDMSessionAVFoundationCF_h
28
28
29
#include "CDMSession.h"
29
#include "CDMSession.h"
30
#include <wtf/PassOwnPtr.h>
31
#include <wtf/RetainPtr.h>
30
#include <wtf/RetainPtr.h>
32
31
33
#if HAVE(AVFOUNDATION_LOADER_DELEGATE) && ENABLE(ENCRYPTED_MEDIA_V2)
32
#if HAVE(AVFOUNDATION_LOADER_DELEGATE) && ENABLE(ENCRYPTED_MEDIA_V2)
- a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp -5 / +5 lines
Lines 189-195 private: a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp_sec1
189
    mutable RetainPtr<CACFLayerRef> m_caVideoLayer;
189
    mutable RetainPtr<CACFLayerRef> m_caVideoLayer;
190
    RefPtr<PlatformCALayer> m_videoLayerWrapper;
190
    RefPtr<PlatformCALayer> m_videoLayerWrapper;
191
191
192
    OwnPtr<LayerClient> m_layerClient;
192
    std::unique_ptr<LayerClient> m_layerClient;
193
    COMPtr<IDirect3DDevice9Ex> m_d3dDevice;
193
    COMPtr<IDirect3DDevice9Ex> m_d3dDevice;
194
194
195
    InbandTextTrackPrivateAVF* m_currentTextTrack;
195
    InbandTextTrackPrivateAVF* m_currentTextTrack;
Lines 1623-1629 void AVFWrapper::processNotification(void* context) a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp_sec2
1623
    if (!context)
1623
    if (!context)
1624
        return;
1624
        return;
1625
1625
1626
    OwnPtr<NotificationCallbackData> notificationData = adoptPtr(reinterpret_cast<NotificationCallbackData*>(context));
1626
    std::unique_ptr<NotificationCallbackData> notificationData { static_cast<NotificationCallbackData*>(context) };
1627
1627
1628
    MutexLocker locker(mapLock());
1628
    MutexLocker locker(mapLock());
1629
    AVFWrapper* self = avfWrapperForCallbackContext(notificationData->m_context);
1629
    AVFWrapper* self = avfWrapperForCallbackContext(notificationData->m_context);
Lines 1673-1681 void AVFWrapper::notificationCallback(CFNotificationCenterRef, void* observer, C a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp_sec3
1673
    LOG(Media, "AVFWrapper::notificationCallback(if=%d) %s", reinterpret_cast<uintptr_t>(observer), notificationName);
1673
    LOG(Media, "AVFWrapper::notificationCallback(if=%d) %s", reinterpret_cast<uintptr_t>(observer), notificationName);
1674
#endif
1674
#endif
1675
1675
1676
    OwnPtr<NotificationCallbackData> notificationData = adoptPtr(new NotificationCallbackData(propertyName, observer));
1676
    auto notificationData = std::make_unique<NotificationCallbackData>(propertyName, observer);
1677
1677
1678
    dispatch_async_f(dispatch_get_main_queue(), notificationData.leakPtr(), processNotification);
1678
    dispatch_async_f(dispatch_get_main_queue(), notificationData.release(), processNotification);
1679
}
1679
}
1680
1680
1681
void AVFWrapper::loadPlayableCompletionCallback(AVCFAssetRef, void* context)
1681
void AVFWrapper::loadPlayableCompletionCallback(AVCFAssetRef, void* context)
Lines 1917-1923 PlatformLayer* AVFWrapper::platformLayer() a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp_sec4
1917
        return 0;
1917
        return 0;
1918
1918
1919
    // Create a PlatformCALayer so we can resize the video layer to match the element size.
1919
    // Create a PlatformCALayer so we can resize the video layer to match the element size.
1920
    m_layerClient = adoptPtr(new LayerClient(this));
1920
    m_layerClient = std::make_unique<LayerClient>(this);
1921
    if (!m_layerClient)
1921
    if (!m_layerClient)
1922
        return 0;
1922
        return 0;
1923
1923
- a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp -3 / +3 lines
Lines 34-40 a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp_sec1
34
#include "FloatPoint.h"
34
#include "FloatPoint.h"
35
#include "FloatRect.h"
35
#include "FloatRect.h"
36
#include "IntRect.h"
36
#include "IntRect.h"
37
#include "OwnPtrCairo.h"
38
#include "Path.h"
37
#include "Path.h"
39
#include "PlatformPathCairo.h"
38
#include "PlatformPathCairo.h"
40
#include "RefPtrCairo.h"
39
#include "RefPtrCairo.h"
Lines 73-80 void setSourceRGBAFromColor(cairo_t* context, const Color& color) a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp_sec2
73
72
74
void appendPathToCairoContext(cairo_t* to, cairo_t* from)
73
void appendPathToCairoContext(cairo_t* to, cairo_t* from)
75
{
74
{
76
    OwnPtr<cairo_path_t> cairoPath = adoptPtr(cairo_copy_path(from));
75
    auto cairoPath = cairo_copy_path(from);
77
    cairo_append_path(to, cairoPath.get());
76
    cairo_append_path(to, cairoPath);
77
    cairo_path_destroy(cairoPath);
78
}
78
}
79
79
80
void setPathOnCairoContext(cairo_t* to, cairo_t* from)
80
void setPathOnCairoContext(cairo_t* to, cairo_t* from)
- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp -2 / +1 lines
Lines 43-49 a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec1
43
#include <cairo.h>
43
#include <cairo.h>
44
#include <runtime/JSCInlines.h>
44
#include <runtime/JSCInlines.h>
45
#include <runtime/TypedArrayInlines.h>
45
#include <runtime/TypedArrayInlines.h>
46
#include <wtf/PassOwnPtr.h>
47
#include <wtf/Vector.h>
46
#include <wtf/Vector.h>
48
#include <wtf/text/Base64.h>
47
#include <wtf/text/Base64.h>
49
#include <wtf/text/WTFString.h>
48
#include <wtf/text/WTFString.h>
Lines 119-125 ImageBuffer::ImageBuffer(const FloatSize& size, float /* resolutionScale */, Col a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec2
119
118
120
    RefPtr<cairo_t> cr = adoptRef(cairo_create(m_data.m_surface.get()));
119
    RefPtr<cairo_t> cr = adoptRef(cairo_create(m_data.m_surface.get()));
121
    m_data.m_platformContext.setCr(cr.get());
120
    m_data.m_platformContext.setCr(cr.get());
122
    m_data.m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext));
121
    m_data.m_context = std::make_unique<GraphicsContext>(&m_data.m_platformContext);
123
    success = true;
122
    success = true;
124
}
123
}
125
124
- a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h -1 / +1 lines
Lines 50-56 public: a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h_sec1
50
50
51
    RefPtr<cairo_surface_t> m_surface;
51
    RefPtr<cairo_surface_t> m_surface;
52
    PlatformContextCairo m_platformContext;
52
    PlatformContextCairo m_platformContext;
53
    OwnPtr<GraphicsContext> m_context;
53
    std::unique_ptr<GraphicsContext> m_context;
54
    IntSize m_size;
54
    IntSize m_size;
55
55
56
#if ENABLE(ACCELERATED_2D_CANVAS)
56
#if ENABLE(ACCELERATED_2D_CANVAS)
- a/Source/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp -50 lines
Lines 1-50 a/Source/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Collabora Ltd.
3
 *
4
 *  This library is free software; you can redistribute it and/or
5
 *  modify it under the terms of the GNU Lesser General Public
6
 *  License as published by the Free Software Foundation; either
7
 *  version 2 of the License, or (at your option) any later version.
8
 *
9
 *  This library is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 *  Lesser General Public License for more details.
13
 *
14
 *  You should have received a copy of the GNU Lesser General Public
15
 *  License along with this library; if not, write to the Free
16
 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 *  Boston, MA 02110-1301 USA
18
 */
19
20
#include "config.h"
21
#include "OwnPtrCairo.h"
22
23
#if USE(CAIRO)
24
25
#if USE(FREETYPE)
26
#include <cairo-ft.h>
27
#include <fontconfig/fcfreetype.h>
28
#endif
29
30
#include <cairo.h>
31
32
namespace WTF {
33
34
#if USE(FREETYPE)
35
template <> void deleteOwnedPtr<FcObjectSet>(FcObjectSet* ptr)
36
{
37
    if (ptr)
38
        FcObjectSetDestroy(ptr);
39
}
40
41
template <> void deleteOwnedPtr<FcFontSet>(FcFontSet* ptr)
42
{
43
    if (ptr)
44
        FcFontSetDestroy(ptr);
45
}
46
#endif
47
48
} // namespace WTF
49
50
#endif // USE(CAIRO)
- a/Source/WebCore/platform/graphics/cairo/OwnPtrCairo.h -46 lines
Lines 1-46 a/Source/WebCore/platform/graphics/cairo/OwnPtrCairo.h_sec1
1
/*
2
 * Copyright (C) 2010 Collabora Ltd.
3
 *
4
 *  This library is free software; you can redistribute it and/or
5
 *  modify it under the terms of the GNU Lesser General Public
6
 *  License as published by the Free Software Foundation; either
7
 *  version 2 of the License, or (at your option) any later version.
8
 *
9
 *  This library is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 *  Lesser General Public License for more details.
13
 *
14
 *  You should have received a copy of the GNU Lesser General Public
15
 *  License along with this library; if not, write to the Free
16
 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 *  Boston, MA 02110-1301 USA
18
 */
19
20
#ifndef OwnPtrCairo_h
21
#define OwnPtrCairo_h
22
23
#if USE(CAIRO)
24
25
#include <wtf/OwnPtr.h>
26
#include <wtf/PassOwnPtr.h>
27
28
#if USE(FREETYPE)
29
typedef struct _FcObjectSet FcObjectSet;
30
typedef struct _FcFontSet FcFontSet;
31
#endif
32
33
typedef struct cairo_path cairo_path_t;
34
35
namespace WTF {
36
37
#if USE(FREETYPE)
38
template <> void deleteOwnedPtr<FcObjectSet>(FcObjectSet*);
39
template <> void deleteOwnedPtr<FcFontSet>(FcFontSet*);
40
#endif
41
42
} // namespace WTF
43
44
#endif // USE(CAIRO)
45
46
#endif // OwnPtrCairo_h
- a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp -10 / +11 lines
Lines 31-37 a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp_sec1
31
#include "AffineTransform.h"
31
#include "AffineTransform.h"
32
#include "FloatRect.h"
32
#include "FloatRect.h"
33
#include "GraphicsContext.h"
33
#include "GraphicsContext.h"
34
#include "OwnPtrCairo.h"
35
#include "PlatformPathCairo.h"
34
#include "PlatformPathCairo.h"
36
#include "StrokeStyleApplier.h"
35
#include "StrokeStyleApplier.h"
37
#include <cairo.h>
36
#include <cairo.h>
Lines 59-66 Path::Path(const Path& other) a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp_sec2
59
        return;
58
        return;
60
59
61
    cairo_t* cr = ensurePlatformPath()->context();
60
    cairo_t* cr = ensurePlatformPath()->context();
62
    OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
61
    auto pathCopy = cairo_copy_path(other.platformPath()->context());
63
    cairo_append_path(cr, pathCopy.get());
62
    cairo_append_path(cr, pathCopy);
63
    cairo_path_destroy(pathCopy);
64
}
64
}
65
65
66
PlatformPathPtr Path::ensurePlatformPath()
66
PlatformPathPtr Path::ensurePlatformPath()
Lines 83-90 Path& Path::operator=(const Path& other) a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp_sec3
83
    } else {
83
    } else {
84
        clear();
84
        clear();
85
        cairo_t* cr = ensurePlatformPath()->context();
85
        cairo_t* cr = ensurePlatformPath()->context();
86
        OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
86
        auto pathCopy = cairo_copy_path(other.platformPath()->context());
87
        cairo_append_path(cr, pathCopy.get());
87
        cairo_append_path(cr, pathCopy);
88
        cairo_path_destroy(pathCopy);
88
    }
89
    }
89
90
90
    return *this;
91
    return *this;
Lines 323-333 void Path::addPath(const Path& path, const AffineTransform& transform) a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp_sec4
323
    cairo_t* cr = path.platformPath()->context();
324
    cairo_t* cr = path.platformPath()->context();
324
    cairo_save(cr);
325
    cairo_save(cr);
325
    cairo_transform(cr, &matrix);
326
    cairo_transform(cr, &matrix);
326
    std::unique_ptr<cairo_path_t, void(*)(cairo_path_t*)> pathCopy(cairo_copy_path(cr), [](cairo_path_t* path) {
327
    auto pathCopy = cairo_copy_path(cr);
327
        cairo_path_destroy(path);
328
    });
329
    cairo_restore(cr);
328
    cairo_restore(cr);
330
    cairo_append_path(ensurePlatformPath()->context(), pathCopy.get());
329
    cairo_append_path(ensurePlatformPath()->context(), pathCopy);
330
    cairo_path_destroy(pathCopy);
331
}
331
}
332
332
333
void Path::closeSubpath()
333
void Path::closeSubpath()
Lines 396-402 void Path::apply(void* info, PathApplierFunction function) const a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp_sec5
396
        return;
396
        return;
397
397
398
    cairo_t* cr = platformPath()->context();
398
    cairo_t* cr = platformPath()->context();
399
    OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(cr));
399
    auto pathCopy = cairo_copy_path(cr);
400
    cairo_path_data_t* data;
400
    cairo_path_data_t* data;
401
    PathElement pelement;
401
    PathElement pelement;
402
    FloatPoint points[3];
402
    FloatPoint points[3];
Lines 428-433 void Path::apply(void* info, PathApplierFunction function) const a/Source/WebCore/platform/graphics/cairo/PathCairo.cpp_sec6
428
            break;
428
            break;
429
        }
429
        }
430
    }
430
    }
431
    cairo_path_destroy(pathCopy);
431
}
432
}
432
433
433
void Path::transform(const AffineTransform& trans)
434
void Path::transform(const AffineTransform& trans)
- a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp -3 / +3 lines
Lines 33-39 a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp_sec1
33
#include "CairoUtilities.h"
33
#include "CairoUtilities.h"
34
#include "Gradient.h"
34
#include "Gradient.h"
35
#include "GraphicsContext.h"
35
#include "GraphicsContext.h"
36
#include "OwnPtrCairo.h"
37
#include "Pattern.h"
36
#include "Pattern.h"
38
#include <cairo.h>
37
#include <cairo.h>
39
38
Lines 306-312 void PlatformContextCairo::clipForPatternFilling(const GraphicsContextState& sta a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp_sec2
306
    ASSERT(state.fillPattern);
305
    ASSERT(state.fillPattern);
307
306
308
    // Hold current cairo path in a variable for restoring it after configuring the pattern clip rectangle.
307
    // Hold current cairo path in a variable for restoring it after configuring the pattern clip rectangle.
309
    OwnPtr<cairo_path_t> currentPath = adoptPtr(cairo_copy_path(m_cr.get()));
308
    auto currentPath = cairo_copy_path(m_cr.get());
310
    cairo_new_path(m_cr.get());
309
    cairo_new_path(m_cr.get());
311
310
312
    // Initialize clipping extent from current cairo clip extents, then shrink if needed according to pattern.
311
    // Initialize clipping extent from current cairo clip extents, then shrink if needed according to pattern.
Lines 337-343 void PlatformContextCairo::clipForPatternFilling(const GraphicsContextState& sta a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp_sec3
337
    }
336
    }
338
337
339
    // Restoring cairo path.
338
    // Restoring cairo path.
340
    cairo_append_path(m_cr.get(), currentPath.get());
339
    cairo_append_path(m_cr.get(), currentPath);
340
    cairo_path_destroy(currentPath);
341
}
341
}
342
342
343
} // namespace WebCore
343
} // namespace WebCore
- a/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp -1 lines
Lines 23-29 a/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp_sec1
23
#include "FontCache.h"
23
#include "FontCache.h"
24
24
25
#include "Font.h"
25
#include "Font.h"
26
#include "OwnPtrCairo.h"
27
#include "RefPtrCairo.h"
26
#include "RefPtrCairo.h"
28
#include "UTF16UChar32Iterator.h"
27
#include "UTF16UChar32Iterator.h"
29
#include <cairo-ft.h>
28
#include <cairo-ft.h>
- a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp -1 lines
Lines 24-30 a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp_sec1
24
#include "OpenGLShims.h"
24
#include "OpenGLShims.h"
25
#include <GL/glx.h>
25
#include <GL/glx.h>
26
#include <cairo.h>
26
#include <cairo.h>
27
#include <wtf/OwnPtr.h>
28
27
29
#if ENABLE(ACCELERATED_2D_CANVAS)
28
#if ENABLE(ACCELERATED_2D_CANVAS)
30
#include <cairo-gl.h>
29
#include <cairo-gl.h>
- a/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp -1 / +1 lines
Lines 130-136 EGLOffScreenSurface::EGLOffScreenSurface(SurfaceAttributes surfaceAttributes) a/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp_sec1
130
    if (m_sharedDisplay == EGL_NO_DISPLAY)
130
    if (m_sharedDisplay == EGL_NO_DISPLAY)
131
        return;
131
        return;
132
132
133
    m_configSelector = adoptPtr(new EGLConfigSelector(surfaceAttributes));
133
    m_configSelector = std::make_unique<EGLConfigSelector>(surfaceAttributes);
134
}
134
}
135
135
136
EGLOffScreenSurface::~EGLOffScreenSurface()
136
EGLOffScreenSurface::~EGLOffScreenSurface()
- a/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h -7 / +5 lines
Lines 140-153 private: a/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h_sec1
140
    GLXFBConfig findMatchingConfig(const int attributes[], int depth = 32)
140
    GLXFBConfig findMatchingConfig(const int attributes[], int depth = 32)
141
    {
141
    {
142
        int numAvailableConfigs;
142
        int numAvailableConfigs;
143
        OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
143
        std::unique_ptr<GLXFBConfig[], X11Deleter> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
144
144
145
        if (!numAvailableConfigs || !temp.get())
145
        if (!numAvailableConfigs || !temp.get())
146
            return 0;
146
            return 0;
147
147
148
        OwnPtrX11<XVisualInfo> scopedVisualInfo;
149
        for (int i = 0; i < numAvailableConfigs; ++i) {
148
        for (int i = 0; i < numAvailableConfigs; ++i) {
150
            scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]);
149
            std::unique_ptr<XVisualInfo, X11Deleter> scopedVisualInfo { glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]) };
151
            if (!scopedVisualInfo.get())
150
            if (!scopedVisualInfo.get())
152
                continue;
151
                continue;
153
152
Lines 169-175 private: a/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h_sec2
169
        }
168
        }
170
169
171
        // Did not find any visual supporting alpha, select the first available config.
170
        // Did not find any visual supporting alpha, select the first available config.
172
        scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[0]);
171
        std::unique_ptr<XVisualInfo, X11Deleter> scopedVisualInfo { glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[0]) };
173
172
174
        if ((m_attributes & GLPlatformSurface::SupportAlpha) && (scopedVisualInfo->depth != 32))
173
        if ((m_attributes & GLPlatformSurface::SupportAlpha) && (scopedVisualInfo->depth != 32))
175
            m_attributes &= ~GLPlatformSurface::SupportAlpha;
174
            m_attributes &= ~GLPlatformSurface::SupportAlpha;
Lines 180-193 private: a/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h_sec3
180
    GLXFBConfig findMatchingConfigWithVisualId(const int attributes[], int depth, VisualID id)
179
    GLXFBConfig findMatchingConfigWithVisualId(const int attributes[], int depth, VisualID id)
181
    {
180
    {
182
        int numAvailableConfigs;
181
        int numAvailableConfigs;
183
        OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
182
        std::unique_ptr<GLXFBConfig[], X11Deleter> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
184
183
185
        if (!numAvailableConfigs || !temp.get())
184
        if (!numAvailableConfigs || !temp.get())
186
            return 0;
185
            return 0;
187
186
188
        OwnPtrX11<XVisualInfo> scopedVisualInfo;
189
        for (int i = 0; i < numAvailableConfigs; ++i) {
187
        for (int i = 0; i < numAvailableConfigs; ++i) {
190
            scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]);
188
            std::unique_ptr<XVisualInfo, X11Deleter> scopedVisualInfo { glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]) };
191
            if (!scopedVisualInfo.get())
189
            if (!scopedVisualInfo.get())
192
                continue;
190
                continue;
193
191
- a/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp -2 / +2 lines
Lines 67-73 GLXTransportSurface::GLXTransportSurface(const IntSize& size, SurfaceAttributes a/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp_sec1
67
    m_sharedDisplay = X11Helper::nativeDisplay();
67
    m_sharedDisplay = X11Helper::nativeDisplay();
68
    attributes |= GLPlatformSurface::DoubleBuffered;
68
    attributes |= GLPlatformSurface::DoubleBuffered;
69
    m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
69
    m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
70
    OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
70
    std::unique_ptr<XVisualInfo, X11Deleter> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
71
71
72
    if (!visInfo.get()) {
72
    if (!visInfo.get()) {
73
        destroy();
73
        destroy();
Lines 145-151 void GLXOffScreenSurface::initialize(SurfaceAttributes attributes) a/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp_sec2
145
145
146
    m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
146
    m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
147
147
148
    OwnPtrX11<XVisualInfo> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
148
    std::unique_ptr<XVisualInfo, X11Deleter> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
149
    X11Helper::createPixmap(&m_pixmap, *visualInfo.get());
149
    X11Helper::createPixmap(&m_pixmap, *visualInfo.get());
150
150
151
    if (!m_pixmap) {
151
    if (!m_pixmap) {
- a/Source/WebCore/platform/graphics/surfaces/glx/OwnPtrX11.h -66 lines
Lines 1-66 a/Source/WebCore/platform/graphics/surfaces/glx/OwnPtrX11.h_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef OwnPtrX11_h
27
#define OwnPtrX11_h
28
29
namespace WebCore {
30
31
template<typename T>
32
struct OwnPtrX11 {
33
34
    OwnPtrX11() : m_xResource(0) { }
35
    OwnPtrX11(T* xResource) : m_xResource(xResource) { }
36
37
    ~OwnPtrX11()
38
    {
39
        if (m_xResource)
40
            XFree(m_xResource);
41
    }
42
43
    OwnPtrX11& operator=(T* xResource)
44
    {
45
        if (m_xResource)
46
            XFree(m_xResource);
47
48
        m_xResource = xResource;
49
        return *this;
50
    }
51
52
    operator T*() const { return m_xResource; }
53
    T* operator->() const { return m_xResource; }
54
    T* get() const { return m_xResource; }
55
56
private:
57
    OwnPtrX11(const OwnPtrX11&);
58
    OwnPtrX11& operator=(const OwnPtrX11&);
59
    static void* operator new (size_t);
60
    static void operator delete (void*);
61
    T* m_xResource;
62
};
63
64
}
65
66
#endif
- a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp -2 / +2 lines
Lines 240-246 void X11Helper::createOffScreenWindow(uint32_t* handleId, const EGLint id, bool a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp_sec1
240
    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
240
    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
241
    visualInfoTemplate.visualid = visualId;
241
    visualInfoTemplate.visualid = visualId;
242
    int matchingCount = 0;
242
    int matchingCount = 0;
243
    OwnPtrX11<XVisualInfo> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
243
    std::unique_ptr<XVisualInfo, X11Deleter> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
244
    XVisualInfo* foundVisual = 0;
244
    XVisualInfo* foundVisual = 0;
245
245
246
    if (matchingVisuals) {
246
    if (matchingVisuals) {
Lines 277-283 void X11Helper::createPixmap(Pixmap* handleId, const EGLint id, bool hasAlpha, c a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp_sec2
277
    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
277
    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
278
    visualInfoTemplate.visualid = visualId;
278
    visualInfoTemplate.visualid = visualId;
279
    int matchingCount = 0;
279
    int matchingCount = 0;
280
    OwnPtrX11<XVisualInfo> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
280
    std::unique_ptr<XVisualInfo, X11Deleter> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
281
    XVisualInfo* foundVisual = 0;
281
    XVisualInfo* foundVisual = 0;
282
    int requiredDepth = hasAlpha ? 32 : 24;
282
    int requiredDepth = hasAlpha ? 32 : 24;
283
283
- a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h -3 / +9 lines
Lines 27-33 a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h_sec1
27
#define X11Helper_h
27
#define X11Helper_h
28
28
29
#include "IntRect.h"
29
#include "IntRect.h"
30
#include "OwnPtrX11.h"
31
30
32
#if USE(EGL)
31
#if USE(EGL)
33
#include <opengl/GLDefs.h>
32
#include <opengl/GLDefs.h>
Lines 43-50 a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h_sec2
43
42
44
namespace WebCore {
43
namespace WebCore {
45
44
46
class X11Helper {
45
class X11Deleter {
46
public:
47
    template<typename T> void operator()(T* resource)
48
    {
49
        if (resource)
50
            XFree(resource);
51
    }
52
};
47
53
54
class X11Helper {
48
public:
55
public:
49
    static void createPixmap(Pixmap*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
56
    static void createPixmap(Pixmap*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
50
    static void createOffScreenWindow(uint32_t*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
57
    static void createOffScreenWindow(uint32_t*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
Lines 61-67 public: a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h_sec3
61
};
68
};
62
69
63
class ScopedXPixmapCreationErrorHandler {
70
class ScopedXPixmapCreationErrorHandler {
64
65
public:
71
public:
66
    ScopedXPixmapCreationErrorHandler();
72
    ScopedXPixmapCreationErrorHandler();
67
    ~ScopedXPixmapCreationErrorHandler();
73
    ~ScopedXPixmapCreationErrorHandler();
- a/Source/WebCore/platform/graphics/win/FullScreenController.cpp -6 / +5 lines
Lines 36-42 a/Source/WebCore/platform/graphics/win/FullScreenController.cpp_sec1
36
#include "MediaPlayerPrivateFullscreenWindow.h"
36
#include "MediaPlayerPrivateFullscreenWindow.h"
37
#include "Timer.h"
37
#include "Timer.h"
38
#include "WebCoreInstanceHandle.h"
38
#include "WebCoreInstanceHandle.h"
39
#include <wtf/PassOwnPtr.h>
40
#include <wtf/RefPtr.h>
39
#include <wtf/RefPtr.h>
41
40
42
using namespace WebCore;
41
using namespace WebCore;
Lines 60-67 public: a/Source/WebCore/platform/graphics/win/FullScreenController.cpp_sec2
60
    
59
    
61
    FullScreenController* m_controller;
60
    FullScreenController* m_controller;
62
    FullScreenControllerClient* m_client;
61
    FullScreenControllerClient* m_client;
63
    OwnPtr<MediaPlayerPrivateFullscreenWindow> m_fullScreenWindow;
62
    std::unique_ptr<MediaPlayerPrivateFullscreenWindow> m_fullScreenWindow;
64
    OwnPtr<MediaPlayerPrivateFullscreenWindow> m_backgroundWindow;
63
    std::unique_ptr<MediaPlayerPrivateFullscreenWindow> m_backgroundWindow;
65
    IntRect m_fullScreenFrame;
64
    IntRect m_fullScreenFrame;
66
    IntRect m_originalFrame;
65
    IntRect m_originalFrame;
67
    HWND m_originalHost;
66
    HWND m_originalHost;
Lines 104-110 LRESULT FullScreenController::Private::fullscreenClientWndProc(HWND hwnd, UINT m a/Source/WebCore/platform/graphics/win/FullScreenController.cpp_sec3
104
}
103
}
105
104
106
FullScreenController::FullScreenController(FullScreenControllerClient* client)
105
FullScreenController::FullScreenController(FullScreenControllerClient* client)
107
    : m_private(adoptPtr(new FullScreenController::Private(this, client)))
106
    : m_private(std::make_unique<Private>(this, client))
108
{
107
{
109
    ASSERT_ARG(client, client);
108
    ASSERT_ARG(client, client);
110
}
109
}
Lines 134-146 void FullScreenController::enterFullScreen() a/Source/WebCore/platform/graphics/win/FullScreenController.cpp_sec4
134
    m_private->m_originalFrame = originalFrame;
133
    m_private->m_originalFrame = originalFrame;
135
134
136
    ASSERT(!m_private->m_backgroundWindow);
135
    ASSERT(!m_private->m_backgroundWindow);
137
    m_private->m_backgroundWindow = adoptPtr(new MediaPlayerPrivateFullscreenWindow(m_private.get()));
136
    m_private->m_backgroundWindow = std::make_unique<MediaPlayerPrivateFullscreenWindow>(m_private.get());
138
    m_private->m_backgroundWindow->createWindow(0);
137
    m_private->m_backgroundWindow->createWindow(0);
139
    ::AnimateWindow(m_private->m_backgroundWindow->hwnd(), kFullScreenAnimationDuration, AW_BLEND | AW_ACTIVATE);
138
    ::AnimateWindow(m_private->m_backgroundWindow->hwnd(), kFullScreenAnimationDuration, AW_BLEND | AW_ACTIVATE);
140
139
141
    m_private->m_client->fullScreenClientWillEnterFullScreen();
140
    m_private->m_client->fullScreenClientWillEnterFullScreen();
142
    ASSERT(!m_private->m_fullScreenWindow);
141
    ASSERT(!m_private->m_fullScreenWindow);
143
    m_private->m_fullScreenWindow = adoptPtr(new MediaPlayerPrivateFullscreenWindow(m_private.get()));
142
    m_private->m_fullScreenWindow = std::make_unique<MediaPlayerPrivateFullscreenWindow>(m_private.get());
144
    ASSERT(m_private->m_fullScreenWindow);
143
    ASSERT(m_private->m_fullScreenWindow);
145
    m_private->m_fullScreenWindow->createWindow(0);
144
    m_private->m_fullScreenWindow->createWindow(0);
146
145
- a/Source/WebCore/platform/graphics/win/FullScreenController.h -2 / +2 lines
Lines 28-34 a/Source/WebCore/platform/graphics/win/FullScreenController.h_sec1
28
28
29
#if ENABLE(FULLSCREEN_API)
29
#if ENABLE(FULLSCREEN_API)
30
30
31
#include <wtf/OwnPtr.h>
31
#include <memory>
32
32
33
namespace WebCore {
33
namespace WebCore {
34
34
Lines 54-60 protected: a/Source/WebCore/platform/graphics/win/FullScreenController.h_sec2
54
54
55
    class Private;
55
    class Private;
56
    friend class Private;
56
    friend class Private;
57
    OwnPtr<FullScreenController::Private> m_private;
57
    std::unique_ptr<FullScreenController::Private> m_private;
58
};
58
};
59
59
60
}
60
}
- a/Source/WebCore/platform/graphics/win/GraphicsContext3DWin.cpp -2 lines
Lines 29-36 a/Source/WebCore/platform/graphics/win/GraphicsContext3DWin.cpp_sec1
29
#include "GraphicsContext3D.h"
29
#include "GraphicsContext3D.h"
30
#include "GraphicsContext3DPrivate.h"
30
#include "GraphicsContext3DPrivate.h"
31
#include <WebCore/PlatformCALayerWin.h>
31
#include <WebCore/PlatformCALayerWin.h>
32
#include <wtf/OwnPtr.h>
33
#include <wtf/PassOwnPtr.h>
34
32
35
#if PLATFORM(WIN)
33
#if PLATFORM(WIN)
36
#include <GLSLANG/ShaderLang.h>
34
#include <GLSLANG/ShaderLang.h>
- a/Source/WebCore/platform/graphics/win/WKCAImageQueue.cpp -3 / +2 lines
Lines 28-34 a/Source/WebCore/platform/graphics/win/WKCAImageQueue.cpp_sec1
28
28
29
#include <CoreFoundation/CoreFoundation.h>
29
#include <CoreFoundation/CoreFoundation.h>
30
#include <WebKitSystemInterface/WebKitSystemInterface.h>
30
#include <WebKitSystemInterface/WebKitSystemInterface.h>
31
#include <wtf/PassOwnPtr.h>
32
#include <wtf/RetainPtr.h>
31
#include <wtf/RetainPtr.h>
33
32
34
namespace WebCore {
33
namespace WebCore {
Lines 52-64 static void WKCAImageQueueRelease(CAImageQueueRef iq) a/Source/WebCore/platform/graphics/win/WKCAImageQueue.cpp_sec2
52
}
51
}
53
52
54
WKCAImageQueue::WKCAImageQueue(uint32_t width, uint32_t height, uint32_t capacity)
53
WKCAImageQueue::WKCAImageQueue(uint32_t width, uint32_t height, uint32_t capacity)
55
    : m_private(adoptPtr(new WKCAImageQueuePrivate()))
54
    : m_private(std::make_unique<WKCAImageQueuePrivate>())
56
{
55
{
57
    m_private->m_imageQueue = adoptCF(wkCAImageQueueCreate(width, height, capacity));
56
    m_private->m_imageQueue = adoptCF(wkCAImageQueueCreate(width, height, capacity));
58
}
57
}
59
58
60
WKCAImageQueue::WKCAImageQueue(const WKCAImageQueue& o)
59
WKCAImageQueue::WKCAImageQueue(const WKCAImageQueue& o)
61
    : m_private(adoptPtr(new WKCAImageQueuePrivate()))
60
    : m_private(std::make_unique<WKCAImageQueuePrivate>())
62
{
61
{
63
    m_private->m_imageQueue = o.m_private->m_imageQueue;
62
    m_private->m_imageQueue = o.m_private->m_imageQueue;
64
}
63
}
- a/Source/WebCore/platform/graphics/win/WKCAImageQueue.h -2 / +2 lines
Lines 29-36 a/Source/WebCore/platform/graphics/win/WKCAImageQueue.h_sec1
29
typedef const void * CFTypeRef;
29
typedef const void * CFTypeRef;
30
typedef const struct __CFDictionary * CFDictionaryRef;
30
typedef const struct __CFDictionary * CFDictionaryRef;
31
31
32
#include <memory>
32
#include <stdint.h>
33
#include <stdint.h>
33
#include <wtf/OwnPtr.h>
34
34
35
namespace WebCore {
35
namespace WebCore {
36
36
Lines 80-86 public: a/Source/WebCore/platform/graphics/win/WKCAImageQueue.h_sec2
80
private:
80
private:
81
    WKCAImageQueue(const WKCAImageQueue&);
81
    WKCAImageQueue(const WKCAImageQueue&);
82
    WKCAImageQueue& operator=(const WKCAImageQueue&);
82
    WKCAImageQueue& operator=(const WKCAImageQueue&);
83
    OwnPtr<WKCAImageQueuePrivate> m_private;
83
    std::unique_ptr<WKCAImageQueuePrivate> m_private;
84
};
84
};
85
85
86
}
86
}
- a/Source/WebCore/platform/network/NetworkStorageSessionStub.cpp -1 lines
Lines 30-36 a/Source/WebCore/platform/network/NetworkStorageSessionStub.cpp_sec1
30
#include "NetworkStorageSession.h"
30
#include "NetworkStorageSession.h"
31
31
32
#include "NetworkingContext.h"
32
#include "NetworkingContext.h"
33
#include <wtf/PassOwnPtr.h>
34
33
35
namespace WebCore {
34
namespace WebCore {
36
35
- a/Source/WebCore/platform/network/ResourceHandleInternal.h -2 / +1 lines
Lines 31-37 a/Source/WebCore/platform/network/ResourceHandleInternal.h_sec1
31
#include "ResourceRequest.h"
31
#include "ResourceRequest.h"
32
#include "AuthenticationChallenge.h"
32
#include "AuthenticationChallenge.h"
33
#include "Timer.h"
33
#include "Timer.h"
34
#include <wtf/OwnPtr.h>
35
34
36
#if USE(CFNETWORK)
35
#if USE(CFNETWORK)
37
#include "ResourceHandleCFURLConnectionDelegate.h"
36
#include "ResourceHandleCFURLConnectionDelegate.h"
Lines 163-169 namespace WebCore { a/Source/WebCore/platform/network/ResourceHandleInternal.h_sec2
163
        unsigned m_sslErrors;
162
        unsigned m_sslErrors;
164
        Vector<char> m_postBytes;
163
        Vector<char> m_postBytes;
165
164
166
        OwnPtr<MultipartHandle> m_multipartHandle;
165
        std::unique_ptr<MultipartHandle> m_multipartHandle;
167
#endif
166
#endif
168
#if USE(SOUP)
167
#if USE(SOUP)
169
        GRefPtr<SoupMessage> m_soupMessage;
168
        GRefPtr<SoupMessage> m_soupMessage;
- a/Source/WebCore/platform/network/curl/MultipartHandle.cpp -5 lines
Lines 37-47 a/Source/WebCore/platform/network/curl/MultipartHandle.cpp_sec1
37
37
38
namespace WebCore {
38
namespace WebCore {
39
39
40
PassOwnPtr<MultipartHandle> MultipartHandle::create(ResourceHandle* handle, const String& boundary)
41
{
42
    return adoptPtr(new MultipartHandle(handle, boundary));
43
}
44
45
bool MultipartHandle::extractBoundary(const String& contentType, String& boundary)
40
bool MultipartHandle::extractBoundary(const String& contentType, String& boundary)
46
{
41
{
47
    static const size_t length = strlen("boundary=");
42
    static const size_t length = strlen("boundary=");
- a/Source/WebCore/platform/network/curl/MultipartHandle.h -4 lines
Lines 28-44 a/Source/WebCore/platform/network/curl/MultipartHandle.h_sec1
28
28
29
#include "HTTPHeaderMap.h"
29
#include "HTTPHeaderMap.h"
30
#include "ResourceHandle.h"
30
#include "ResourceHandle.h"
31
32
#include <wtf/OwnPtr.h>
33
#include <wtf/Vector.h>
31
#include <wtf/Vector.h>
34
#include <wtf/text/WTFString.h>
32
#include <wtf/text/WTFString.h>
35
33
36
namespace WebCore {
34
namespace WebCore {
37
35
38
class MultipartHandle {
36
class MultipartHandle {
39
40
public:
37
public:
41
    static PassOwnPtr<MultipartHandle> create(ResourceHandle* handle, const String& boundary);
42
    static bool extractBoundary(const String& contentType, String& boundary);
38
    static bool extractBoundary(const String& contentType, String& boundary);
43
39
44
    MultipartHandle(ResourceHandle* handle, const String& boundary)
40
    MultipartHandle(ResourceHandle* handle, const String& boundary)
- a/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp -1 / +1 lines
Lines 515-521 static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data) a/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp_sec1
515
            String boundary;
515
            String boundary;
516
            bool parsed = MultipartHandle::extractBoundary(d->m_response.httpHeaderField(HTTPHeaderName::ContentType), boundary);
516
            bool parsed = MultipartHandle::extractBoundary(d->m_response.httpHeaderField(HTTPHeaderName::ContentType), boundary);
517
            if (parsed)
517
            if (parsed)
518
                d->m_multipartHandle = MultipartHandle::create(job, boundary);
518
                d->m_multipartHandle = std::make_unique<MultipartHandle>(job, boundary);
519
        }
519
        }
520
520
521
#if ENABLE(WEB_TIMING)
521
#if ENABLE(WEB_TIMING)
- a/Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.h -1 / +1 lines
Lines 29-35 a/Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.h_sec1
29
#if ENABLE(NETWORK_CACHE)
29
#if ENABLE(NETWORK_CACHE)
30
30
31
#include "NetworkCacheCoder.h"
31
#include "NetworkCacheCoder.h"
32
32
#include <wtf/HashFunctions.h>
33
#include <wtf/StringHasher.h>
33
#include <wtf/StringHasher.h>
34
#include <wtf/Vector.h>
34
#include <wtf/Vector.h>
35
35
- a/Tools/ChangeLog +26 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2015-04-24  Darin Adler  <darin@apple.com>
2
3
        Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
4
        https://bugs.webkit.org/show_bug.cgi?id=128007
5
6
        Reviewed by Anders Carlsson.
7
8
        * DumpRenderTree/win/HistoryDelegate.h: Removed unneeded include.
9
        * DumpRenderTree/win/UIDelegate.h: Ditto.
10
11
        * TestWebKitAPI/Tests/WTF/HashMap.cpp: Removed OwnPtr-specific test cases.
12
        * TestWebKitAPI/Tests/WTF/HashSet.cpp: Ditto.
13
14
        * TestWebKitAPI/Tests/WebKit/win/WebViewDestruction.cpp: Removed unneeded include.
15
16
        * TestWebKitAPI/Tests/WebKit2/UserMessage.cpp: Use unique_ptr.
17
        (TestWebKitAPI::WebKit2UserMessageRoundTripTest::SetUp): Use make_unique.
18
        * TestWebKitAPI/Tests/WebKit2/WillLoad.cpp: Ditto.
19
        (TestWebKitAPI::WebKit2WillLoadTest::SetUp): Ditto.
20
        * TestWebKitAPI/Tests/WebKit2Gtk/DOMDOMWindowTest.cpp:
21
        (WebKitDOMDOMWindowTest::create): Ditto.
22
        * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
23
        (documentLoadedCallback): Use a queue of DelayedSignal objects instead
24
        of smart pointers to DelayedSIgnal objects.
25
        (uriChangedCallback): Ditto.
26
1
2015-04-24  Brent Fulgham  <bfulgham@apple.com>
27
2015-04-24  Brent Fulgham  <bfulgham@apple.com>
2
28
3
        [Mac] Unreviewed test fix.
29
        [Mac] Unreviewed test fix.
- a/Tools/DumpRenderTree/win/HistoryDelegate.h -1 lines
Lines 27-33 a/Tools/DumpRenderTree/win/HistoryDelegate.h_sec1
27
#define HistoryDelegate_h
27
#define HistoryDelegate_h
28
28
29
#include <WebKit/WebKit.h>
29
#include <WebKit/WebKit.h>
30
#include <wtf/OwnPtr.h>
31
30
32
class HistoryDelegate : public IWebHistoryDelegate {
31
class HistoryDelegate : public IWebHistoryDelegate {
33
public:
32
public:
- a/Tools/DumpRenderTree/win/UIDelegate.h -1 lines
Lines 31-37 a/Tools/DumpRenderTree/win/UIDelegate.h_sec1
31
31
32
#include <WebCore/COMPtr.h>
32
#include <WebCore/COMPtr.h>
33
#include <WebKit/WebKit.h>
33
#include <WebKit/WebKit.h>
34
#include <wtf/OwnPtr.h>
35
#include <windef.h>
34
#include <windef.h>
36
35
37
class DRTUndoManager;
36
class DRTUndoManager;
- a/Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp -97 lines
Lines 30-37 a/Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp_sec1
30
#include "RefLogger.h"
30
#include "RefLogger.h"
31
#include <string>
31
#include <string>
32
#include <wtf/HashMap.h>
32
#include <wtf/HashMap.h>
33
#include <wtf/OwnPtr.h>
34
#include <wtf/PassOwnPtr.h>
35
#include <wtf/text/StringHash.h>
33
#include <wtf/text/StringHash.h>
36
34
37
namespace TestWebKitAPI {
35
namespace TestWebKitAPI {
Lines 174-274 TEST(WTF_HashMap, EfficientGetter) a/Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp_sec2
174
    }
172
    }
175
}
173
}
176
174
177
TEST(WTF_HashMap, OwnPtrKey)
178
{
179
    ConstructorDestructorCounter::TestingScope scope;
180
181
    HashMap<OwnPtr<ConstructorDestructorCounter>, int> map;
182
183
    OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
184
    map.add(WTF::move(ownPtr), 2);
185
186
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
187
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
188
189
    map.clear();
190
    
191
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
192
    EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
193
}
194
195
TEST(WTF_HashMap, OwnPtrKey_FindUsingRawPointer)
196
{
197
    HashMap<OwnPtr<int>, int> map;
198
199
    OwnPtr<int> ownPtr = adoptPtr(new int(5));
200
    int* ptr = ownPtr.get();
201
    map.add(WTF::move(ownPtr), 2);
202
203
    auto it = map.find(ptr);
204
    ASSERT_TRUE(it != map.end());
205
    EXPECT_EQ(ptr, it->key.get());
206
    EXPECT_EQ(2, it->value);
207
}
208
209
TEST(WTF_HashMap, OwnPtrKey_ContainsUsingRawPointer)
210
{
211
    HashMap<OwnPtr<int>, int> map;
212
213
    OwnPtr<int> ownPtr = adoptPtr(new int(5));
214
    int* ptr = ownPtr.get();
215
    map.add(WTF::move(ownPtr), 2);
216
217
    EXPECT_EQ(true, map.contains(ptr));
218
}
219
220
TEST(WTF_HashMap, OwnPtrKey_GetUsingRawPointer)
221
{
222
    HashMap<OwnPtr<int>, int> map;
223
224
    OwnPtr<int> ownPtr = adoptPtr(new int(5));
225
    int* ptr = ownPtr.get();
226
    map.add(WTF::move(ownPtr), 2);
227
228
    int value = map.get(ptr);
229
    EXPECT_EQ(2, value);
230
}
231
232
TEST(WTF_HashMap, OwnPtrKey_RemoveUsingRawPointer)
233
{
234
    ConstructorDestructorCounter::TestingScope scope;
235
236
    HashMap<OwnPtr<ConstructorDestructorCounter>, int> map;
237
238
    OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
239
    ConstructorDestructorCounter* ptr = ownPtr.get();
240
    map.add(WTF::move(ownPtr), 2);
241
242
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
243
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
244
245
    bool result = map.remove(ptr);
246
    EXPECT_EQ(true, result);
247
248
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
249
    EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
250
}
251
252
TEST(WTF_HashMap, OwnPtrKey_TakeUsingRawPointer)
253
{
254
    ConstructorDestructorCounter::TestingScope scope;
255
256
    HashMap<OwnPtr<ConstructorDestructorCounter>, int> map;
257
258
    OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
259
    ConstructorDestructorCounter* ptr = ownPtr.get();
260
    map.add(WTF::move(ownPtr), 2);
261
262
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
263
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
264
265
    int result = map.take(ptr);
266
    EXPECT_EQ(2, result);
267
268
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
269
    EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
270
}
271
272
TEST(WTF_HashMap, UniquePtrKey)
175
TEST(WTF_HashMap, UniquePtrKey)
273
{
176
{
274
    ConstructorDestructorCounter::TestingScope scope;
177
    ConstructorDestructorCounter::TestingScope scope;
- a/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp -89 lines
Lines 28-35 a/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp_sec1
28
#include "Counters.h"
28
#include "Counters.h"
29
#include "MoveOnly.h"
29
#include "MoveOnly.h"
30
#include <wtf/HashSet.h>
30
#include <wtf/HashSet.h>
31
#include <wtf/OwnPtr.h>
32
#include <wtf/PassOwnPtr.h>
33
31
34
namespace TestWebKitAPI {
32
namespace TestWebKitAPI {
35
33
Lines 119-211 TEST(WTF_HashSet, MoveOnly) a/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp_sec2
119
        EXPECT_TRUE(secondSet.contains(MoveOnly(i + 1)));
117
        EXPECT_TRUE(secondSet.contains(MoveOnly(i + 1)));
120
}
118
}
121
119
122
TEST(WTF_HashSet, OwnPtrKey)
123
{
124
    ConstructorDestructorCounter::TestingScope scope;
125
126
    HashSet<OwnPtr<ConstructorDestructorCounter>> set;
127
128
    OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
129
    set.add(WTF::move(ownPtr));
130
131
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
132
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
133
134
    set.clear();
135
    
136
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
137
    EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
138
}
139
140
TEST(WTF_HashSet, OwnPtrKey_FindUsingRawPointer)
141
{
142
    HashSet<OwnPtr<int>> set;
143
144
    OwnPtr<int> ownPtr = adoptPtr(new int(5));
145
    int* ptr = ownPtr.get();
146
    set.add(WTF::move(ownPtr));
147
148
    auto it = set.find(ptr);
149
    ASSERT_TRUE(it != set.end());
150
    EXPECT_EQ(ptr, it->get());
151
    EXPECT_EQ(5, *it->get());
152
}
153
154
TEST(WTF_HashSet, OwnPtrKey_ContainsUsingRawPointer)
155
{
156
    HashSet<OwnPtr<int>> set;
157
158
    OwnPtr<int> ownPtr = adoptPtr(new int(5));
159
    int* ptr = ownPtr.get();
160
    set.add(WTF::move(ownPtr));
161
162
    EXPECT_EQ(true, set.contains(ptr));
163
}
164
165
TEST(WTF_HashSet, OwnPtrKey_RemoveUsingRawPointer)
166
{
167
    ConstructorDestructorCounter::TestingScope scope;
168
169
    HashSet<OwnPtr<ConstructorDestructorCounter>> set;
170
171
    OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
172
    ConstructorDestructorCounter* ptr = ownPtr.get();
173
    set.add(WTF::move(ownPtr));
174
175
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
176
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
177
178
    bool result = set.remove(ptr);
179
    EXPECT_EQ(true, result);
180
181
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
182
    EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
183
}
184
185
TEST(WTF_HashSet, OwnPtrKey_TakeUsingRawPointer)
186
{
187
    ConstructorDestructorCounter::TestingScope scope;
188
189
    HashSet<OwnPtr<ConstructorDestructorCounter>> set;
190
191
    OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
192
    ConstructorDestructorCounter* ptr = ownPtr.get();
193
    set.add(WTF::move(ownPtr));
194
195
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
196
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
197
198
    auto result = set.take(ptr);
199
    EXPECT_EQ(ptr, result.get());
200
201
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
202
    EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
203
204
    result = nullptr;
205
206
    EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
207
    EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
208
}
209
120
210
TEST(WTF_HashSet, UniquePtrKey)
121
TEST(WTF_HashSet, UniquePtrKey)
211
{
122
{
- a/Tools/TestWebKitAPI/Tests/WebKit/win/WebViewDestruction.cpp -1 lines
Lines 29-35 a/Tools/TestWebKitAPI/Tests/WebKit/win/WebViewDestruction.cpp_sec1
29
#include <WebCore/COMPtr.h>
29
#include <WebCore/COMPtr.h>
30
#include <WebKit/WebKit.h>
30
#include <WebKit/WebKit.h>
31
#include <WebKit/WebKitCOMAPI.h>
31
#include <WebKit/WebKitCOMAPI.h>
32
#include <wtf/PassOwnPtr.h>
33
32
34
namespace TestWebKitAPI {
33
namespace TestWebKitAPI {
35
34
- a/Tools/TestWebKitAPI/Tests/WebKit2/UserMessage.cpp -4 / +2 lines
Lines 31-38 a/Tools/TestWebKitAPI/Tests/WebKit2/UserMessage.cpp_sec1
31
31
32
#include "PlatformUtilities.h"
32
#include "PlatformUtilities.h"
33
#include "PlatformWebView.h"
33
#include "PlatformWebView.h"
34
#include <wtf/OwnPtr.h>
35
#include <wtf/PassOwnPtr.h>
36
34
37
namespace TestWebKitAPI {
35
namespace TestWebKitAPI {
38
36
Lines 45-51 public: a/Tools/TestWebKitAPI/Tests/WebKit2/UserMessage.cpp_sec2
45
    }
43
    }
46
44
47
    WKRetainPtr<WKContextRef> context;
45
    WKRetainPtr<WKContextRef> context;
48
    OwnPtr<PlatformWebView> webView;
46
    std::unique_ptr<PlatformWebView> webView;
49
47
50
    WKRetainPtr<WKTypeRef> recievedBody;
48
    WKRetainPtr<WKTypeRef> recievedBody;
51
49
Lines 95-101 public: a/Tools/TestWebKitAPI/Tests/WebKit2/UserMessage.cpp_sec3
95
        context = adoptWK(Util::createContextForInjectedBundleTest("UserMessageTest"));
93
        context = adoptWK(Util::createContextForInjectedBundleTest("UserMessageTest"));
96
        setInjectedBundleClient(context.get(), this);
94
        setInjectedBundleClient(context.get(), this);
97
95
98
        webView = adoptPtr(new PlatformWebView(context.get()));
96
        webView = std::make_unique<PlatformWebView>(context.get());
99
        setPageLoaderClient(webView->page(), this);
97
        setPageLoaderClient(webView->page(), this);
100
98
101
        didFinishLoad = false;
99
        didFinishLoad = false;
- a/Tools/TestWebKitAPI/Tests/WebKit2/WillLoad.cpp -4 / +2 lines
Lines 31-38 a/Tools/TestWebKitAPI/Tests/WebKit2/WillLoad.cpp_sec1
31
31
32
#include "PlatformUtilities.h"
32
#include "PlatformUtilities.h"
33
#include "PlatformWebView.h"
33
#include "PlatformWebView.h"
34
#include <wtf/OwnPtr.h>
35
#include <wtf/PassOwnPtr.h>
36
34
37
namespace TestWebKitAPI {
35
namespace TestWebKitAPI {
38
36
Lines 44-50 public: a/Tools/TestWebKitAPI/Tests/WebKit2/WillLoad.cpp_sec2
44
    }
42
    }
45
43
46
    WKRetainPtr<WKContextRef> context;
44
    WKRetainPtr<WKContextRef> context;
47
    OwnPtr<PlatformWebView> webView;
45
    std::unique_ptr<PlatformWebView> webView;
48
46
49
    WKRetainPtr<WKStringRef> messageName;
47
    WKRetainPtr<WKStringRef> messageName;
50
    WKRetainPtr<WKTypeRef> messageBody;
48
    WKRetainPtr<WKTypeRef> messageBody;
Lines 74-80 public: a/Tools/TestWebKitAPI/Tests/WebKit2/WillLoad.cpp_sec3
74
        context = adoptWK(Util::createContextForInjectedBundleTest("WillLoadTest"));
72
        context = adoptWK(Util::createContextForInjectedBundleTest("WillLoadTest"));
75
        setInjectedBundleClient(context.get(), this);
73
        setInjectedBundleClient(context.get(), this);
76
74
77
        webView = adoptPtr(new PlatformWebView(context.get()));
75
        webView = std::make_unique<PlatformWebView>(context.get());
78
76
79
        didReceiveMessage = false;
77
        didReceiveMessage = false;
80
    }
78
    }
- a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMDOMWindowTest.cpp -1 / +1 lines
Lines 30-36 static gboolean clickedCallback(WebKitDOMDOMWindow*, WebKitDOMEvent*, WebKitDOMD a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/DOMDOMWindowTest.cpp_sec1
30
30
31
class WebKitDOMDOMWindowTest : public WebProcessTest {
31
class WebKitDOMDOMWindowTest : public WebProcessTest {
32
public:
32
public:
33
    static PassOwnPtr<WebProcessTest> create() { return adoptPtr(new WebKitDOMDOMWindowTest()); }
33
    static std::unique_ptr<WebProcessTest> create() { return std::make_unique<WebKitDOMDOMWindowTest>(); }
34
34
35
private:
35
private:
36
    guint64 webPageFromArgs(GVariant* args)
36
    guint64 webPageFromArgs(GVariant* args)
- a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp -8 / +6 lines
Lines 26-33 a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp_sec1
26
#include <string.h>
26
#include <string.h>
27
#include <webkit2/webkit-web-extension.h>
27
#include <webkit2/webkit-web-extension.h>
28
#include <wtf/Deque.h>
28
#include <wtf/Deque.h>
29
#include <wtf/OwnPtr.h>
30
#include <wtf/PassOwnPtr.h>
31
#include <wtf/ProcessID.h>
29
#include <wtf/ProcessID.h>
32
#include <wtf/gobject/GRefPtr.h>
30
#include <wtf/gobject/GRefPtr.h>
33
#include <wtf/gobject/GUniquePtr.h>
31
#include <wtf/gobject/GUniquePtr.h>
Lines 83-89 struct DelayedSignal { a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp_sec2
83
    CString uri;
81
    CString uri;
84
};
82
};
85
83
86
Deque<OwnPtr<DelayedSignal>> delayedSignalsQueue;
84
Deque<DelayedSignal> delayedSignalsQueue;
87
85
88
static void emitDocumentLoaded(GDBusConnection* connection)
86
static void emitDocumentLoaded(GDBusConnection* connection)
89
{
87
{
Lines 115-121 static void documentLoadedCallback(WebKitWebPage* webPage, WebKitWebExtension* e a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp_sec3
115
    if (data)
113
    if (data)
116
        emitDocumentLoaded(G_DBUS_CONNECTION(data));
114
        emitDocumentLoaded(G_DBUS_CONNECTION(data));
117
    else
115
    else
118
        delayedSignalsQueue.append(adoptPtr(new DelayedSignal(DocumentLoadedSignal)));
116
        delayedSignalsQueue.append(DelayedSignal(DocumentLoadedSignal));
119
}
117
}
120
118
121
static void emitURIChanged(GDBusConnection* connection, const char* uri)
119
static void emitURIChanged(GDBusConnection* connection, const char* uri)
Lines 137-143 static void uriChangedCallback(WebKitWebPage* webPage, GParamSpec* pspec, WebKit a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp_sec4
137
    if (data)
135
    if (data)
138
        emitURIChanged(G_DBUS_CONNECTION(data), webkit_web_page_get_uri(webPage));
136
        emitURIChanged(G_DBUS_CONNECTION(data), webkit_web_page_get_uri(webPage));
139
    else
137
    else
140
        delayedSignalsQueue.append(adoptPtr(new DelayedSignal(URIChangedSignal, webkit_web_page_get_uri(webPage))));
138
        delayedSignalsQueue.append(DelayedSignal(URIChangedSignal, webkit_web_page_get_uri(webPage)));
141
}
139
}
142
140
143
static gboolean sendRequestCallback(WebKitWebPage*, WebKitURIRequest* request, WebKitURIResponse* redirectResponse, gpointer)
141
static gboolean sendRequestCallback(WebKitWebPage*, WebKitURIRequest* request, WebKitURIResponse* redirectResponse, gpointer)
Lines 330-342 static void busAcquiredCallback(GDBusConnection* connection, const char* name, g a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp_sec5
330
328
331
    g_object_set_data(G_OBJECT(userData), "dbus-connection", connection);
329
    g_object_set_data(G_OBJECT(userData), "dbus-connection", connection);
332
    while (delayedSignalsQueue.size()) {
330
    while (delayedSignalsQueue.size()) {
333
        OwnPtr<DelayedSignal> delayedSignal = delayedSignalsQueue.takeFirst();
331
        DelayedSignal delayedSignal = delayedSignalsQueue.takeFirst();
334
        switch (delayedSignal->type) {
332
        switch (delayedSignal.type) {
335
        case DocumentLoadedSignal:
333
        case DocumentLoadedSignal:
336
            emitDocumentLoaded(connection);
334
            emitDocumentLoaded(connection);
337
            break;
335
            break;
338
        case URIChangedSignal:
336
        case URIChangedSignal:
339
            emitURIChanged(connection, delayedSignal->uri.data());
337
            emitURIChanged(connection, delayedSignal.uri.data());
340
            break;
338
            break;
341
        }
339
        }
342
    }
340
    }

Return to Bug 128007