<!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>[163346] trunk/Source</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/163346">163346</a></dd>
<dt>Author</dt> <dd>bburg@apple.com</dd>
<dt>Date</dt> <dd>2014-02-03 17:02:23 -0800 (Mon, 03 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix for 128110</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjecth">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/JavaScriptCore/replay/</li>
<li><a href="#trunkSourceJavaScriptCorereplayEmptyInputCursorh">trunk/Source/JavaScriptCore/replay/EmptyInputCursor.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayInputCursorh">trunk/Source/JavaScriptCore/replay/InputCursor.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayNondeterministicInputh">trunk/Source/JavaScriptCore/replay/NondeterministicInput.h</a></li>
<li>trunk/Source/WebCore/ForwardingHeaders/replay/</li>
<li><a href="#trunkSourceWebCoreForwardingHeadersreplayEmptyInputCursorh">trunk/Source/WebCore/ForwardingHeaders/replay/EmptyInputCursor.h</a></li>
<li><a href="#trunkSourceWebCoreForwardingHeadersreplayInputCursorh">trunk/Source/WebCore/ForwardingHeaders/replay/InputCursor.h</a></li>
<li><a href="#trunkSourceWebCoreForwardingHeadersreplayNondeterministicInputh">trunk/Source/WebCore/ForwardingHeaders/replay/NondeterministicInput.h</a></li>
<li>trunk/Source/WebCore/replay/</li>
<li><a href="#trunkSourceWebCorereplayEventLoopInputh">trunk/Source/WebCore/replay/EventLoopInput.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-02-03  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Replay: upstream base input classes and the input cursor interface
+        https://bugs.webkit.org/show_bug.cgi?id=128110
+
+        Reviewed by Joseph Pecoraro.
+
+        Add the base class for all replay inputs. Add InputTraits, a trait that
+        provides an input's queue, type, and encode/decode methods statically so
+        that they can be used within templated helper functions in InputCursor and
+        EncodedValue.
+
+        Add the InputCursor base class which mediates the saving and fetching of
+        replay inputs from a replay recording by instrumented nondeterministic code.
+
+        Add a dummy cursor implementation. This allows us to return a cursor reference
+        to clients even if no capturing or replaying is happening.
+
+        Add the ability to set an InputCursor instance on a JSGlobalObject. This
+        is the means for connecting a replay recording to a script context.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * replay/EmptyInputCursor.h: Added.
+        (JSC::EmptyInputCursor::~EmptyInputCursor):
+        (JSC::EmptyInputCursor::create):
+        (JSC::EmptyInputCursor::EmptyInputCursor):
+        * replay/InputCursor.h: Added.
+        (JSC::InputCursor::InputCursor):
+        (JSC::InputCursor::~InputCursor):
+        (JSC::InputCursor::appendInput):
+        (JSC::InputCursor::fetchInput):
+        * replay/NondeterministicInput.h: Added.
+        (JSC::NondeterministicInputBase::NondeterministicInputBase):
+        (JSC::NondeterministicInputBase::~NondeterministicInputBase):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::JSGlobalObject):
+        (JSC::JSGlobalObject::setInputCursor):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::inputCursor):
+
</ins><span class="cx"> 2014-02-03  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the cloop due to GenGC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -916,6 +916,9 @@
</span><span class="cx">                 969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07950ED1D3AE00F1F681 /* Opcode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 978801401471AD920041B016 /* JSDateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9788FC221471AD0C0068CE2D /* JSDateMath.cpp */; };
</span><span class="cx">                 978801411471AD920041B016 /* JSDateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 9788FC231471AD0C0068CE2D /* JSDateMath.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                99E45A1018A01F350026D88F /* EmptyInputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A0D18A01F350026D88F /* EmptyInputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                99E45A1118A01F350026D88F /* InputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A0E18A01F350026D88F /* InputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                99E45A1218A01F350026D88F /* NondeterministicInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A0F18A01F350026D88F /* NondeterministicInput.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1712B3A11C7B212007A5315 /* RegExpCache.cpp */; };
</span><span class="cx">                 A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2352,6 +2355,9 @@
</span><span class="cx">                 969A09220ED1E09C00F1F681 /* Completion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Completion.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9788FC221471AD0C0068CE2D /* JSDateMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDateMath.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9788FC231471AD0C0068CE2D /* JSDateMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDateMath.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                99E45A0D18A01F350026D88F /* EmptyInputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EmptyInputCursor.h; path = replay/EmptyInputCursor.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                99E45A0E18A01F350026D88F /* InputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputCursor.h; path = replay/InputCursor.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                99E45A0F18A01F350026D88F /* NondeterministicInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NondeterministicInput.h; path = replay/NondeterministicInput.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2955,6 +2961,7 @@
</span><span class="cx">                                 7E39D8370EC3A388003AF11A /* parser */,
</span><span class="cx">                                 034768DFFF38A50411DB9C8B /* Products */,
</span><span class="cx">                                 95AB831A0DA42C6900BC83F3 /* profiler */,
</span><ins>+                                99E45A0C18A01E930026D88F /* replay */,
</ins><span class="cx">                                 932FC3C20824BB70005B3C75 /* Resources */,
</span><span class="cx">                                 7EF6E0BB0EB7A1EC0079AFAF /* runtime */,
</span><span class="cx">                                 141211000A48772600480255 /* tests */,
</span><span class="lines">@@ -4452,6 +4459,16 @@
</span><span class="cx">                         path = bytecode;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                99E45A0C18A01E930026D88F /* replay */ = {
+                        isa = PBXGroup;
+                        children = (
+                                99E45A0D18A01F350026D88F /* EmptyInputCursor.h */,
+                                99E45A0E18A01F350026D88F /* InputCursor.h */,
+                                99E45A0F18A01F350026D88F /* NondeterministicInput.h */,
+                        );
+                        name = replay;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 A513E5CC185FB992007E95AD /* agents */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -4901,6 +4918,7 @@
</span><span class="cx">                                 0FEA0A10170513DB00BB722C /* FTLLowerDFGToLLVM.h in Headers */,
</span><span class="cx">                                 A7D89D0217A0B90400773AD8 /* FTLLoweredNodeValue.h in Headers */,
</span><span class="cx">                                 0FD8A31C17D51F2200CA2C40 /* FTLOSREntry.h in Headers */,
</span><ins>+                                99E45A1118A01F350026D88F /* InputCursor.h in Headers */,
</ins><span class="cx">                                 0F235BDD17178E1C00690C7F /* FTLOSRExit.h in Headers */,
</span><span class="cx">                                 0F235BDE17178E1C00690C7F /* FTLOSRExitCompilationInfo.h in Headers */,
</span><span class="cx">                                 0F235BE017178E1C00690C7F /* FTLOSRExitCompiler.h in Headers */,
</span><span class="lines">@@ -5071,6 +5089,7 @@
</span><span class="cx">                                 BC18C45E0E16F5CD00B34460 /* JSStack.h in Headers */,
</span><span class="cx">                                 A7C1EAF017987AB600299DB2 /* JSStackInlines.h in Headers */,
</span><span class="cx">                                 BC18C4270E16F5CD00B34460 /* JSString.h in Headers */,
</span><ins>+                                99E45A1218A01F350026D88F /* NondeterministicInput.h in Headers */,
</ins><span class="cx">                                 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */,
</span><span class="cx">                                 2600B5A7152BAAA70091EE5F /* JSStringJoiner.h in Headers */,
</span><span class="cx">                                 BC18C4280E16F5CD00B34460 /* JSStringRef.h in Headers */,
</span><span class="lines">@@ -5270,6 +5289,7 @@
</span><span class="cx">                                 E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */,
</span><span class="cx">                                 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */,
</span><span class="cx">                                 A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */,
</span><ins>+                                99E45A1018A01F350026D88F /* EmptyInputCursor.h in Headers */,
</ins><span class="cx">                                 0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */,
</span><span class="cx">                                 0FD82E54141DAEEE00179C94 /* SpeculatedType.h in Headers */,
</span><span class="cx">                                 A7C1EAF217987AB600299DB2 /* StackVisitor.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayEmptyInputCursorh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/EmptyInputCursor.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/EmptyInputCursor.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/replay/EmptyInputCursor.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
+ * IS&quot; 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 THE COPYRIGHT
+ * HOLDER 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.
+ */
+
+#ifndef EmptyInputCursor_h
+#define EmptyInputCursor_h
+
+#if ENABLE(WEB_REPLAY)
+
+#include &quot;InputCursor.h&quot;
+#include &lt;wtf/Assertions.h&gt;
+#include &lt;wtf/Noncopyable.h&gt;
+
+namespace JSC {
+
+class EmptyInputCursor final : public InputCursor {
+    WTF_MAKE_NONCOPYABLE(EmptyInputCursor);
+public:
+    virtual ~EmptyInputCursor() { }
+
+    static PassRefPtr&lt;EmptyInputCursor&gt; create()
+    {
+        return adoptRef(new EmptyInputCursor());
+    }
+
+    virtual bool isCapturing() const override { return false; }
+    virtual bool isReplaying() const override { return false; }
+
+    virtual NondeterministicInputBase* uncheckedLoadInput(InputQueue) override
+    {
+        ASSERT_NOT_REACHED();
+        return nullptr;
+    }
+
+    virtual void storeInput(std::unique_ptr&lt;NondeterministicInputBase&gt;) override
+    {
+        ASSERT_NOT_REACHED();
+    }
+
+protected:
+    virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString&amp;) override
+    {
+        ASSERT_NOT_REACHED();
+        return nullptr;
+    }
+
+private:
+    EmptyInputCursor() { }
+};
+
+} // namespace JSC
+
+using JSC::EmptyInputCursor;
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // EmptyInputCursor_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayInputCursorh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/InputCursor.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/InputCursor.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/replay/InputCursor.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2011, 2012 University of Washington. All rights reserved.
+ * Copyright (C) 2014 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
+ * IS&quot; 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 THE COPYRIGHT
+ * HOLDER 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.
+ */
+
+#ifndef InputCursor_h
+#define InputCursor_h
+
+#if ENABLE(WEB_REPLAY)
+
+#include &quot;NondeterministicInput.h&quot;
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/text/AtomicString.h&gt;
+
+namespace JSC {
+
+class InputCursor : public RefCounted&lt;InputCursor&gt; {
+    WTF_MAKE_NONCOPYABLE(InputCursor);
+public:
+    InputCursor() { }
+
+    virtual ~InputCursor() { }
+
+    virtual bool isCapturing() const = 0;
+    virtual bool isReplaying() const = 0;
+
+    template &lt;class InputType, class... Args&gt; inline
+    void appendInput(Args&amp;&amp;... args)
+    {
+        InputType* rawInput = WTF::safeCast&lt;InputType*&gt;(new InputType(std::forward&lt;Args&gt;(args)...));
+        return storeInput(std::unique_ptr&lt;NondeterministicInputBase&gt;(rawInput));
+    }
+
+    template &lt;class InputType&gt; inline
+    InputType* fetchInput()
+    {
+        return static_cast&lt;InputType*&gt;(loadInput(InputTraits&lt;InputType&gt;::queue(), InputTraits&lt;InputType&gt;::type()));
+    }
+
+    virtual void storeInput(std::unique_ptr&lt;NondeterministicInputBase&gt;) = 0;
+    virtual NondeterministicInputBase* uncheckedLoadInput(InputQueue) = 0;
+protected:
+    virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString&amp;) = 0;
+};
+
+} // namespace JSC
+
+using JSC::InputCursor;
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // InputCursor_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayNondeterministicInputh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/NondeterministicInput.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/NondeterministicInput.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/replay/NondeterministicInput.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+/*
+ * Copyright (C) 2011, 2012 University of Washington. All rights reserved.
+ * Copyright (C) 2014 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
+ * IS&quot; 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 THE COPYRIGHT
+ * HOLDER 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.
+ */
+
+#ifndef NondeterministicInput_h
+#define NondeterministicInput_h
+
+#if ENABLE(WEB_REPLAY)
+
+#include &lt;wtf/Forward.h&gt;
+#include &lt;wtf/Noncopyable.h&gt;
+
+namespace JSC {
+
+class EncodedValue;
+
+enum class InputQueue {
+    ScriptMemoizedData = 0,
+    LoaderMemoizedData = 1,
+    EventLoopInput = 2,
+    Count = 3
+};
+
+template&lt;typename InputType&gt;
+struct JS_EXPORT_PRIVATE InputTraits {
+    static InputQueue queue();
+    static AtomicString&amp; type();
+
+    static void encode(EncodedValue&amp; encodedInput, InputType&amp; decodedInput);
+    static bool decode(EncodedValue&amp; encodedInput, std::unique_ptr&lt;InputType&gt;&amp; decodedInput);
+};
+
+class NondeterministicInputBase {
+    WTF_MAKE_NONCOPYABLE(NondeterministicInputBase);
+public:
+    NondeterministicInputBase() { }
+    virtual ~NondeterministicInputBase() { }
+
+    virtual const AtomicString&amp; type() const = 0;
+    virtual InputQueue queue() const = 0;
+};
+
+template&lt;typename InputType&gt;
+class NondeterministicInput final : public NondeterministicInputBase {
+    virtual const AtomicString&amp; type() const override
+    {
+        return InputTraits&lt;InputType&gt;::type();
+    }
+
+    virtual InputQueue queue() const override
+    {
+        return InputTraits&lt;InputType&gt;::queue();
+    }
+};
+
+} // namespace JSC
+
+using JSC::InputQueue;
+using JSC::InputTraits;
+using JSC::NondeterministicInput;
+using JSC::NondeterministicInputBase;
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // NondeterministicInput_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -127,6 +127,10 @@
</span><span class="cx"> #include &quot;RemoteInspector.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+#include &quot;EmptyInputCursor.h&quot;
+#endif
+
</ins><span class="cx"> #include &quot;JSGlobalObject.lut.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -152,6 +156,9 @@
</span><span class="cx"> 
</span><span class="cx"> JSGlobalObject::JSGlobalObject(VM&amp; vm, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable)
</span><span class="cx">     : Base(vm, structure, 0)
</span><ins>+#if ENABLE(WEB_REPLAY)
+    , m_inputCursor(EmptyInputCursor::create())
+#endif
</ins><span class="cx">     , m_masqueradesAsUndefinedWatchpoint(adoptRef(new WatchpointSet(IsWatched)))
</span><span class="cx">     , m_havingABadTimeWatchpoint(adoptRef(new WatchpointSet(IsWatched)))
</span><span class="cx">     , m_varInjectionWatchpoint(adoptRef(new WatchpointSet(IsWatched)))
</span><span class="lines">@@ -770,6 +777,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+void JSGlobalObject::setInputCursor(PassRefPtr&lt;InputCursor&gt; prpCursor)
+{
+    m_inputCursor = prpCursor;
+}
+#endif
+
</ins><span class="cx"> void JSGlobalObject::setName(const String&amp; name)
</span><span class="cx"> {
</span><span class="cx">     m_name = name;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> class FunctionPrototype;
</span><span class="cx"> class GetterSetter;
</span><span class="cx"> class GlobalCodeBlock;
</span><ins>+class InputCursor;
</ins><span class="cx"> class JSGlobalObjectDebuggable;
</span><span class="cx"> class JSPromiseConstructor;
</span><span class="cx"> class JSPromisePrototype;
</span><span class="lines">@@ -225,6 +226,10 @@
</span><span class="cx"> 
</span><span class="cx">     Debugger* m_debugger;
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+    RefPtr&lt;InputCursor&gt; m_inputCursor;
+#endif
+
</ins><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">     std::unique_ptr&lt;JSGlobalObjectDebuggable&gt; m_inspectorDebuggable;
</span><span class="cx"> #endif
</span><span class="lines">@@ -417,6 +422,11 @@
</span><span class="cx">     JS_EXPORT_PRIVATE void setRemoteDebuggingEnabled(bool);
</span><span class="cx">     JS_EXPORT_PRIVATE bool remoteDebuggingEnabled() const;
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+    JS_EXPORT_PRIVATE void setInputCursor(PassRefPtr&lt;InputCursor&gt;);
+    InputCursor&amp; inputCursor() const { return *m_inputCursor; }
+#endif
+
</ins><span class="cx">     void setName(const String&amp;);
</span><span class="cx">     const String&amp; name() const { return m_name; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/WebCore/ChangeLog        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2014-02-03  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Replay: upstream base input classes and the input cursor interface
+        https://bugs.webkit.org/show_bug.cgi?id=128110
+
+        Reviewed by Joseph Pecoraro.
+
+        Add EventLoopInput, a base class for replay inputs that are handled
+        as if they begin a new run loop. For example, navigations, user input,
+        network callbacks, and asynchronous timers are modeled by inputs which
+        derive from this base class.
+
+        Add the ability to set an InputCursor instance on a Document. This
+        is the means for connecting a replay recording to a document context.
+
+        Add forwarding headers for some fundamental replay classes.
+
+        No new tests; no new functionality is exposed.
+
+        * ForwardingHeaders/replay/EmptyInputCursor.h: Added.
+        * ForwardingHeaders/replay/InputCursor.h: Added.
+        * ForwardingHeaders/replay/NondeterministicInput.h: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        * dom/Document.h:
+        (WebCore::Document::inputCursor):
+        (WebCore::Document::setInputCursor):
+        * replay/EventLoopInput.h: Added.
+        (WebCore::ReplayPosition::ReplayPosition):
+        (WebCore::ReplayPosition::index):
+        (WebCore::ReplayPosition::time):
+        (WebCore::EventLoopInputBase::EventLoopInputBase):
+        (WebCore::EventLoopInputBase::~EventLoopInputBase):
+        (WebCore::EventLoopInputBase::setPosition):
+        (WebCore::EventLoopInputBase::position):
+
</ins><span class="cx"> 2014-02-03  Jinwoo Song  &lt;jinwoo7.song@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unused code in CSSParser.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersreplayEmptyInputCursorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/replay/EmptyInputCursor.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/replay/EmptyInputCursor.h                                (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/replay/EmptyInputCursor.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+#ifndef WebCore_FWD_EmptyInputCursor_h
+#define WebCore_FWD_EmptyInputCursor_h
+#include &lt;JavaScriptCore/EmptyInputCursor.h&gt;
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersreplayInputCursorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/replay/InputCursor.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/replay/InputCursor.h                                (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/replay/InputCursor.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+#ifndef WebCore_FWD_InputCursor_h
+#define WebCore_FWD_InputCursor_h
+#include &lt;JavaScriptCore/InputCursor.h&gt;
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersreplayNondeterministicInputh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/replay/NondeterministicInput.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/replay/NondeterministicInput.h                                (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/replay/NondeterministicInput.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+#ifndef WebCore_FWD_NondeterministicInput_h
+#define WebCore_FWD_NondeterministicInput_h
+#include &lt;JavaScriptCore/NondeterministicInput.h&gt;
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -3489,6 +3489,7 @@
</span><span class="cx">                 98CE4326129E00BD005821DC /* LinkLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 98CE4325129E00BD005821DC /* LinkLoader.cpp */; };
</span><span class="cx">                 98CE432A129E00E5005821DC /* LinkLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 98CE4329129E00E5005821DC /* LinkLoader.h */; };
</span><span class="cx">                 98EB1F951313FE0500D0E1EA /* NotImplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 98EB1F941313FE0500D0E1EA /* NotImplemented.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                99E45A1718A063BE0026D88F /* EventLoopInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1618A063BE0026D88F /* EventLoopInput.h */; };
</ins><span class="cx">                 9A1142041832D135000BB8AD /* ValueToString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A1142031832D134000BB8AD /* ValueToString.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */; };
</span><span class="cx">                 9A528E8317D7F52F00AA9518 /* FloatingObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A528E8117D7F52F00AA9518 /* FloatingObjects.cpp */; };
</span><span class="lines">@@ -10446,6 +10447,7 @@
</span><span class="cx">                 98CE4325129E00BD005821DC /* LinkLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 98CE4329129E00E5005821DC /* LinkLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkLoader.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 98EB1F941313FE0500D0E1EA /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                99E45A1618A063BE0026D88F /* EventLoopInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventLoopInput.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 9A1142031832D134000BB8AD /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringListCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9A528E8117D7F52F00AA9518 /* FloatingObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatingObjects.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14260,6 +14262,7 @@
</span><span class="cx">                                 BCF1A5BA097832090061A123 /* platform */,
</span><span class="cx">                                 5DCF83690D59157800953BC6 /* plugins */,
</span><span class="cx">                                 F523D2F302DE443B018635CA /* rendering */,
</span><ins>+                                99E45A1318A021760026D88F /* replay */,
</ins><span class="cx">                                 1AE82EC90CAAE177002237AE /* storage */,
</span><span class="cx">                                 E4763D4A17B2704900D35206 /* style */,
</span><span class="cx">                                 B22277CA0D00BF1E0071B782 /* svg */,
</span><span class="lines">@@ -17848,6 +17851,14 @@
</span><span class="cx">                         name = parser;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                99E45A1318A021760026D88F /* replay */ = {
+                        isa = PBXGroup;
+                        children = (
+                                99E45A1618A063BE0026D88F /* EventLoopInput.h */,
+                        );
+                        path = replay;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 A148328B187F506800DA63A6 /* wak */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -24776,6 +24787,7 @@
</span><span class="cx">                                 FBDB61A116D6037E00BB3394 /* PageRuleCollector.h in Headers */,
</span><span class="cx">                                 F3820895147D35F90010BC06 /* PageRuntimeAgent.h in Headers */,
</span><span class="cx">                                 F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */,
</span><ins>+                                99E45A1718A063BE0026D88F /* EventLoopInput.h in Headers */,
</ins><span class="cx">                                 371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */,
</span><span class="cx">                                 A7197F24175689C4007B9442 /* PageThrottler.h in Headers */,
</span><span class="cx">                                 E1284AE110447D4500EAEB52 /* PageTransitionEvent.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -220,6 +220,10 @@
</span><span class="cx"> #include &quot;CaptionUserPreferences.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+#include &lt;replay/EmptyInputCursor.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WTF;
</span><span class="cx"> using namespace Unicode;
</span><span class="cx"> 
</span><span class="lines">@@ -496,6 +500,9 @@
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">     , m_templateDocumentHost(nullptr)
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(WEB_REPLAY)
+    , m_inputCursor(EmptyInputCursor::create())
+#endif
</ins><span class="cx">     , m_didAssociateFormControlsTimer(this, &amp;Document::didAssociateFormControlsTimerFired)
</span><span class="cx">     , m_hasInjectedPlugInsScript(false)
</span><span class="cx">     , m_renderTreeBeingDestroyed(false)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (163345 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-02-04 00:54:16 UTC (rev 163345)
+++ trunk/Source/WebCore/dom/Document.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -59,6 +59,10 @@
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/WeakPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+#include &lt;replay/InputCursor.h&gt;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class AXObjectCache;
</span><span class="lines">@@ -442,6 +446,11 @@
</span><span class="cx"> 
</span><span class="cx">     virtual URL baseURI() const override;
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+    InputCursor&amp; inputCursor() const { return *m_inputCursor; }
+    void setInputCursor(PassRefPtr&lt;InputCursor&gt; cursor) { m_inputCursor = cursor; }
+#endif
+
</ins><span class="cx"> #if ENABLE(PAGE_VISIBILITY_API)
</span><span class="cx">     void visibilityStateChanged();
</span><span class="cx">     String visibilityState() const;
</span><span class="lines">@@ -1645,6 +1654,10 @@
</span><span class="cx">     RefPtr&lt;FontLoader&gt; m_fontloader;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEB_REPLAY)
+    RefPtr&lt;InputCursor&gt; m_inputCursor;
+#endif
+
</ins><span class="cx">     Timer&lt;Document&gt; m_didAssociateFormControlsTimer;
</span><span class="cx">     HashSet&lt;RefPtr&lt;Element&gt;&gt; m_associatedFormControls;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorereplayEventLoopInputh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/replay/EventLoopInput.h (0 => 163346)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/replay/EventLoopInput.h                                (rev 0)
+++ trunk/Source/WebCore/replay/EventLoopInput.h        2014-02-04 01:02:23 UTC (rev 163346)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+/*
+ * Copyright (C) 2011-2013 University of Washington. All rights reserved.
+ * Copyright (C) 2014 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
+ * IS&quot; 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 THE COPYRIGHT
+ * HOLDER 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.
+ */
+
+#ifndef EventLoopInput_h
+#define EventLoopInput_h
+
+#if ENABLE(WEB_REPLAY)
+
+#include &lt;replay/NondeterministicInput.h&gt;
+#include &lt;wtf/CurrentTime.h&gt;
+
+namespace WebCore {
+
+class ReplayController;
+
+struct ReplayPosition {
+public:
+    ReplayPosition()
+        : m_index(0)
+        , m_time(0.0) { }
+
+    explicit ReplayPosition(unsigned index)
+        : m_index(index)
+        , m_time(monotonicallyIncreasingTime()) { }
+
+    unsigned index() const { return m_index; }
+    double time() const { return m_time; }
+private:
+    unsigned m_index;
+    double m_time;
+};
+
+class EventLoopInputBase : public NondeterministicInputBase {
+public:
+    EventLoopInputBase()
+        : m_position(ReplayPosition()) { }
+
+    virtual ~EventLoopInputBase() { }
+    virtual InputQueue queue() const override final { return InputQueue::EventLoopInput; }
+
+    virtual void dispatch(ReplayController&amp;) = 0;
+
+    // During capture, the position is set when the following event loop input is captured.
+    void setPosition(const ReplayPosition&amp; position) { m_position = position; }
+    ReplayPosition position() const { return m_position; }
+protected:
+    ReplayPosition m_position;
+};
+
+template &lt;typename InputType&gt;
+class EventLoopInput : public EventLoopInputBase {
+    virtual const AtomicString&amp; type() const override final
+    {
+        return InputTraits&lt;InputType&gt;::type();
+    }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // EventLoopInput_h
</ins></span></pre>
</div>
</div>

</body>
</html>