<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210258] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210258">210258</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2017-01-03 16:36:32 -0800 (Tue, 03 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename SharedBufferMac.mm to SharedBufferCocoa.mm
https://bugs.webkit.org/show_bug.cgi?id=166666

Reviewed by Tim Horton.

* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformcocoaSharedBufferCocoamm">trunk/Source/WebCore/platform/cocoa/SharedBufferCocoa.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformmacSharedBufferMacmm">trunk/Source/WebCore/platform/mac/SharedBufferMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210257 => 210258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-04 00:33:39 UTC (rev 210257)
+++ trunk/Source/WebCore/ChangeLog        2017-01-04 00:36:32 UTC (rev 210258)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-01-03  Andy Estes  &lt;aestes@apple.com&gt;
+
+        Rename SharedBufferMac.mm to SharedBufferCocoa.mm
+        https://bugs.webkit.org/show_bug.cgi?id=166666
+
+        Reviewed by Tim Horton.
+
+        * PlatformMac.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.
+
</ins><span class="cx"> 2017-01-03  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Re-implement ExceptionOr on top of WTF::Expected
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (210257 => 210258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2017-01-04 00:33:39 UTC (rev 210257)
+++ trunk/Source/WebCore/PlatformMac.cmake        2017-01-04 00:36:32 UTC (rev 210258)
</span><span class="lines">@@ -327,6 +327,7 @@
</span><span class="cx">     platform/cocoa/ScrollController.mm
</span><span class="cx">     platform/cocoa/ScrollSnapAnimatorState.mm
</span><span class="cx">     platform/cocoa/SearchPopupMenuCocoa.mm
</span><ins>+    platform/cocoa/SharedBufferCocoa.mm
</ins><span class="cx">     platform/cocoa/SystemVersion.mm
</span><span class="cx">     platform/cocoa/TelephoneNumberDetectorCocoa.cpp
</span><span class="cx">     platform/cocoa/ThemeCocoa.mm
</span><span class="lines">@@ -483,7 +484,6 @@
</span><span class="cx">     platform/mac/ScrollViewMac.mm
</span><span class="cx">     platform/mac/ScrollbarThemeMac.mm
</span><span class="cx">     platform/mac/SerializedPlatformRepresentationMac.mm
</span><del>-    platform/mac/SharedBufferMac.mm
</del><span class="cx">     platform/mac/SoundMac.mm
</span><span class="cx">     platform/mac/SuddenTermination.mm
</span><span class="cx">     platform/mac/SystemSleepListenerMac.mm
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210257 => 210258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-04 00:33:39 UTC (rev 210257)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-04 00:36:32 UTC (rev 210258)
</span><span class="lines">@@ -714,7 +714,7 @@
</span><span class="cx">                 1A4A2DF20A1B852A00C807F8 /* JSHTMLAppletElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A2DEE0A1B852A00C807F8 /* JSHTMLAppletElement.h */; };
</span><span class="cx">                 1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A954B0B4EDCCB002D8C3C /* SharedBuffer.cpp */; };
</span><span class="cx">                 1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A954C0B4EDCCB002D8C3C /* SharedBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A95510B4EDCFF002D8C3C /* SharedBufferMac.mm */; };
</del><ins>+                1A4A95520B4EDCFF002D8C3C /* SharedBufferCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A95510B4EDCFF002D8C3C /* SharedBufferCocoa.mm */; };
</ins><span class="cx">                 1A4DA4211CDD3A8300F4473C /* LinkIconCollector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4DA41F1CDD3A8300F4473C /* LinkIconCollector.cpp */; };
</span><span class="cx">                 1A4DA4221CDD3A8300F4473C /* LinkIconCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4DA4201CDD3A8300F4473C /* LinkIconCollector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1A569CF70D7E2B82007C3983 /* c_class.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CC60D7E2B82007C3983 /* c_class.cpp */; };
</span><span class="lines">@@ -7750,7 +7750,7 @@
</span><span class="cx">                 1A4A2DEE0A1B852A00C807F8 /* JSHTMLAppletElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLAppletElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A4A954B0B4EDCCB002D8C3C /* SharedBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SharedBuffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A4A954C0B4EDCCB002D8C3C /* SharedBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SharedBuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1A4A95510B4EDCFF002D8C3C /* SharedBufferMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedBufferMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                1A4A95510B4EDCFF002D8C3C /* SharedBufferCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedBufferCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1A4DA41F1CDD3A8300F4473C /* LinkIconCollector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkIconCollector.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A4DA4201CDD3A8300F4473C /* LinkIconCollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkIconCollector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A569CC60D7E2B82007C3983 /* c_class.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_class.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17806,7 +17806,6 @@
</span><span class="cx">                                 9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */,
</span><span class="cx">                                 077AF14118F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h */,
</span><span class="cx">                                 077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */,
</span><del>-                                1A4A95510B4EDCFF002D8C3C /* SharedBufferMac.mm */,
</del><span class="cx">                                 4B3043C80AE0371D00A82647 /* SoundMac.mm */,
</span><span class="cx">                                 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
</span><span class="cx">                                 93B2D8170F9920EE006AE6B2 /* SuddenTermination.mm */,
</span><span class="lines">@@ -19766,6 +19765,7 @@
</span><span class="cx">                                 F478755319983AFF0024A287 /* ScrollSnapAnimatorState.mm */,
</span><span class="cx">                                 0E7058F31BC5CCD70045A507 /* SearchPopupMenuCocoa.h */,
</span><span class="cx">                                 0E7058ED1BC5BC190045A507 /* SearchPopupMenuCocoa.mm */,
</span><ins>+                                1A4A95510B4EDCFF002D8C3C /* SharedBufferCocoa.mm */,
</ins><span class="cx">                                 0A4844980CA44CB200B7BD48 /* SoftLinking.h */,
</span><span class="cx">                                 5D5975B119635F1100D00878 /* SystemVersion.h */,
</span><span class="cx">                                 5D5975B219635F1100D00878 /* SystemVersion.mm */,
</span><span class="lines">@@ -31215,7 +31215,7 @@
</span><span class="cx">                                 1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */,
</span><span class="cx">                                 512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */,
</span><span class="cx">                                 97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */,
</span><del>-                                1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */,
</del><ins>+                                1A4A95520B4EDCFF002D8C3C /* SharedBufferCocoa.mm in Sources */,
</ins><span class="cx">                                 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
</span><span class="cx">                                 E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */,
</span><span class="cx">                                 585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaSharedBufferCocoammfromrev210257trunkSourceWebCoreplatformmacSharedBufferMacmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/SharedBufferCocoa.mm (from rev 210257, trunk/Source/WebCore/platform/mac/SharedBufferMac.mm) (0 => 210258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/SharedBufferCocoa.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/SharedBufferCocoa.mm        2017-01-04 00:36:32 UTC (rev 210258)
</span><span class="lines">@@ -0,0 +1,126 @@
</span><ins>+/*
+ * Copyright (C) 2006 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;SharedBuffer.h&quot;
+
+#include &quot;WebCoreObjCExtras.h&quot;
+#include &lt;runtime/InitializeThreading.h&gt;
+#include &lt;string.h&gt;
+#include &lt;wtf/MainThread.h&gt;
+
+using namespace WebCore;
+
+@interface WebCoreSharedBufferData : NSData
+{
+    RefPtr&lt;SharedBuffer::DataBuffer&gt; sharedBufferDataBuffer;
+}
+
+- (id)initWithSharedBufferDataBuffer:(SharedBuffer::DataBuffer*)dataBuffer;
+@end
+
+@implementation WebCoreSharedBufferData
+
++ (void)initialize
+{
+#if !USE(WEB_THREAD)
+    JSC::initializeThreading();
+    WTF::initializeMainThreadToProcessMainThread();
+#endif // !USE(WEB_THREAD)
+}
+
+- (void)dealloc
+{
+    if (WebCoreObjCScheduleDeallocateOnMainThread([WebCoreSharedBufferData class], self))
+        return;
+
+    [super dealloc];
+}
+
+- (id)initWithSharedBufferDataBuffer:(SharedBuffer::DataBuffer*)dataBuffer
+{
+    self = [super init];
+    
+    if (self)
+        sharedBufferDataBuffer = dataBuffer;
+
+    return self;
+}
+
+- (NSUInteger)length
+{
+    return sharedBufferDataBuffer-&gt;data.size();
+}
+
+- (const void *)bytes
+{
+    return sharedBufferDataBuffer-&gt;data.data();
+}
+
+@end
+
+namespace WebCore {
+
+Ref&lt;SharedBuffer&gt; SharedBuffer::wrapNSData(NSData *nsData)
+{
+    return adoptRef(*new SharedBuffer((CFDataRef)nsData));
+}
+
+RetainPtr&lt;NSData&gt; SharedBuffer::createNSData()
+{
+    return adoptNS((NSData *)createCFData().leakRef());
+}
+
+CFDataRef SharedBuffer::existingCFData()
+{
+    if (m_cfData)
+        return m_cfData.get();
+
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+    if (m_dataArray.size() == 1)
+        return m_dataArray.at(0).get();
+#endif
+
+    return nullptr;
+}
+
+RetainPtr&lt;CFDataRef&gt; SharedBuffer::createCFData()
+{
+    if (CFDataRef cfData = existingCFData())
+        return cfData;
+
+    data(); // Force data into m_buffer from segments or data array.
+    return adoptCF((CFDataRef)adoptNS([[WebCoreSharedBufferData alloc] initWithSharedBufferDataBuffer:m_buffer.ptr()]).leakRef());
+}
+
+RefPtr&lt;SharedBuffer&gt; SharedBuffer::createFromReadingFile(const String&amp; filePath)
+{
+    NSData *resourceData = [NSData dataWithContentsOfFile:filePath];
+    if (resourceData) 
+        return SharedBuffer::wrapNSData(resourceData);
+    return nullptr;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacSharedBufferMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/SharedBufferMac.mm (210257 => 210258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/SharedBufferMac.mm        2017-01-04 00:33:39 UTC (rev 210257)
+++ trunk/Source/WebCore/platform/mac/SharedBufferMac.mm        2017-01-04 00:36:32 UTC (rev 210258)
</span><span class="lines">@@ -1,126 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &quot;config.h&quot;
-#include &quot;SharedBuffer.h&quot;
-
-#include &quot;WebCoreObjCExtras.h&quot;
-#include &lt;runtime/InitializeThreading.h&gt;
-#include &lt;string.h&gt;
-#include &lt;wtf/MainThread.h&gt;
-
-using namespace WebCore;
-
-@interface WebCoreSharedBufferData : NSData
-{
-    RefPtr&lt;SharedBuffer::DataBuffer&gt; sharedBufferDataBuffer;
-}
-
-- (id)initWithSharedBufferDataBuffer:(SharedBuffer::DataBuffer*)dataBuffer;
-@end
-
-@implementation WebCoreSharedBufferData
-
-+ (void)initialize
-{
-#if !USE(WEB_THREAD)
-    JSC::initializeThreading();
-    WTF::initializeMainThreadToProcessMainThread();
-#endif // !USE(WEB_THREAD)
-}
-
-- (void)dealloc
-{
-    if (WebCoreObjCScheduleDeallocateOnMainThread([WebCoreSharedBufferData class], self))
-        return;
-
-    [super dealloc];
-}
-
-- (id)initWithSharedBufferDataBuffer:(SharedBuffer::DataBuffer*)dataBuffer
-{
-    self = [super init];
-    
-    if (self)
-        sharedBufferDataBuffer = dataBuffer;
-
-    return self;
-}
-
-- (NSUInteger)length
-{
-    return sharedBufferDataBuffer-&gt;data.size();
-}
-
-- (const void *)bytes
-{
-    return sharedBufferDataBuffer-&gt;data.data();
-}
-
-@end
-
-namespace WebCore {
-
-Ref&lt;SharedBuffer&gt; SharedBuffer::wrapNSData(NSData *nsData)
-{
-    return adoptRef(*new SharedBuffer((CFDataRef)nsData));
-}
-
-RetainPtr&lt;NSData&gt; SharedBuffer::createNSData()
-{
-    return adoptNS((NSData *)createCFData().leakRef());
-}
-
-CFDataRef SharedBuffer::existingCFData()
-{
-    if (m_cfData)
-        return m_cfData.get();
-
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    if (m_dataArray.size() == 1)
-        return m_dataArray.at(0).get();
-#endif
-
-    return nullptr;
-}
-
-RetainPtr&lt;CFDataRef&gt; SharedBuffer::createCFData()
-{
-    if (CFDataRef cfData = existingCFData())
-        return cfData;
-
-    data(); // Force data into m_buffer from segments or data array.
-    return adoptCF((CFDataRef)adoptNS([[WebCoreSharedBufferData alloc] initWithSharedBufferDataBuffer:m_buffer.ptr()]).leakRef());
-}
-
-RefPtr&lt;SharedBuffer&gt; SharedBuffer::createFromReadingFile(const String&amp; filePath)
-{
-    NSData *resourceData = [NSData dataWithContentsOfFile:filePath];
-    if (resourceData) 
-        return SharedBuffer::wrapNSData(resourceData);
-    return nullptr;
-}
-
-}
</del></span></pre>
</div>
</div>

</body>
</html>