Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (178602 => 178603)
--- trunk/Source/_javascript_Core/ChangeLog 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-01-16 22:13:08 UTC (rev 178603)
@@ -1,5 +1,19 @@
2015-01-16 Brian J. Burg <[email protected]>
+ Web Replay: purge remaining PassRefPtr uses and minor cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=140456
+
+ Reviewed by Andreas Kling.
+
+ Get rid of PassRefPtr. Introduce default initializers where it makes sense.
+ Remove mistaken uses of AtomicString that were not removed as part of r174113.
+
+ * replay/EmptyInputCursor.h:
+ * replay/InputCursor.h:
+ (JSC::InputCursor::InputCursor):
+
+2015-01-16 Brian J. Burg <[email protected]>
+
Web Inspector: code generator should fail on duplicate parameter and member names
https://bugs.webkit.org/show_bug.cgi?id=140555
Modified: trunk/Source/_javascript_Core/replay/EmptyInputCursor.h (178602 => 178603)
--- trunk/Source/_javascript_Core/replay/EmptyInputCursor.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/_javascript_Core/replay/EmptyInputCursor.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -40,9 +40,9 @@
public:
virtual ~EmptyInputCursor() { }
- static PassRefPtr<EmptyInputCursor> create()
+ static Ref<EmptyInputCursor> create()
{
- return adoptRef(new EmptyInputCursor());
+ return adoptRef(*new EmptyInputCursor());
}
virtual bool isCapturing() const override { return false; }
@@ -60,7 +60,7 @@
}
protected:
- virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString&) override
+ virtual NondeterministicInputBase* loadInput(InputQueue, const String&) override
{
ASSERT_NOT_REACHED();
return nullptr;
Modified: trunk/Source/_javascript_Core/replay/InputCursor.h (178602 => 178603)
--- trunk/Source/_javascript_Core/replay/InputCursor.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/_javascript_Core/replay/InputCursor.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -33,18 +33,13 @@
#include "NondeterministicInput.h"
#include <wtf/Noncopyable.h>
#include <wtf/RefCounted.h>
-#include <wtf/text/AtomicString.h>
namespace JSC {
class InputCursor : public RefCounted<InputCursor> {
WTF_MAKE_NONCOPYABLE(InputCursor);
public:
- InputCursor()
- : m_withinEventLoopInputExtent(false)
- {
- }
-
+ InputCursor() { }
virtual ~InputCursor() { }
virtual bool isCapturing() const = 0;
@@ -78,10 +73,10 @@
virtual void storeInput(std::unique_ptr<NondeterministicInputBase>) = 0;
virtual NondeterministicInputBase* uncheckedLoadInput(InputQueue) = 0;
protected:
- virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString&) = 0;
+ virtual NondeterministicInputBase* loadInput(InputQueue, const String&) = 0;
private:
- bool m_withinEventLoopInputExtent;
+ bool m_withinEventLoopInputExtent {false};
};
} // namespace JSC
Modified: trunk/Source/WebCore/ChangeLog (178602 => 178603)
--- trunk/Source/WebCore/ChangeLog 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/ChangeLog 2015-01-16 22:13:08 UTC (rev 178603)
@@ -1,3 +1,81 @@
+2015-01-16 Brian J. Burg <[email protected]>
+
+ Web Replay: purge remaining PassRefPtr uses and minor cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=140456
+
+ Reviewed by Andreas Kling.
+
+ Get rid of PassRefPtr. Introduce default initializers where it makes sense. Change
+ uses of ASSERT to ASSERT_ARG when the assert is a precondition on an argument.
+
+ Remove mistaken uses of AtomicString that were not removed as part of r174113.
+
+ No new tests, no behavior changed.
+
+ * inspector/InspectorReplayAgent.cpp:
+ (WebCore::SerializeInputToJSONFunctor::operator()):
+ (WebCore::SerializeInputToJSONFunctor::returnValue):
+ (WebCore::InspectorReplayAgent::sessionCreated):
+ (WebCore::InspectorReplayAgent::sessionModified):
+ (WebCore::InspectorReplayAgent::sessionLoaded):
+ (WebCore::InspectorReplayAgent::segmentCreated):
+ (WebCore::InspectorReplayAgent::segmentCompleted):
+ (WebCore::InspectorReplayAgent::segmentLoaded):
+ (WebCore::InspectorReplayAgent::switchSession):
+ (WebCore::InspectorReplayAgent::insertSessionSegment):
+ (WebCore::InspectorReplayAgent::removeSessionSegment):
+ (WebCore::InspectorReplayAgent::findSession):
+ (WebCore::InspectorReplayAgent::findSegment):
+ * inspector/InspectorReplayAgent.h:
+ * replay/CapturingInputCursor.cpp:
+ (WebCore::CapturingInputCursor::CapturingInputCursor):
+ (WebCore::CapturingInputCursor::create):
+ (WebCore::CapturingInputCursor::loadInput):
+ * replay/CapturingInputCursor.h:
+ * replay/EventLoopInputDispatcher.cpp:
+ (WebCore::EventLoopInputDispatcher::EventLoopInputDispatcher):
+ * replay/EventLoopInputDispatcher.h:
+ * replay/FunctorInputCursor.h:
+ (WebCore::FunctorInputCursor::FunctorInputCursor):
+ (WebCore::FunctorInputCursor::loadInput):
+ * replay/ReplayController.cpp:
+ (WebCore::ReplayController::ReplayController):
+ (WebCore::ReplayController::setForceDeterministicSettings):
+ (WebCore::ReplayController::setSessionState):
+ (WebCore::ReplayController::setSegmentState):
+ (WebCore::ReplayController::switchSession):
+ (WebCore::ReplayController::createSegment):
+ (WebCore::ReplayController::completeSegment):
+ (WebCore::ReplayController::loadSegmentAtIndex):
+ (WebCore::ReplayController::unloadSegment):
+ (WebCore::ReplayController::frameNavigated):
+ (WebCore::ReplayController::loadedSession):
+ (WebCore::ReplayController::loadedSegment):
+ (WebCore::ReplayController::activeInputCursor):
+ (WebCore::ReplayController::dispatcher):
+ * replay/ReplayController.h:
+ * replay/ReplaySession.cpp:
+ (WebCore::ReplaySession::create):
+ (WebCore::ReplaySession::at):
+ (WebCore::ReplaySession::appendSegment):
+ (WebCore::ReplaySession::insertSegment):
+ (WebCore::ReplaySession::removeSegment):
+ * replay/ReplaySession.h:
+ * replay/ReplaySessionSegment.cpp:
+ (WebCore::ReplaySessionSegment::create):
+ (WebCore::ReplaySessionSegment::ReplaySessionSegment):
+ * replay/ReplaySessionSegment.h:
+ * replay/ReplayingInputCursor.cpp:
+ (WebCore::ReplayingInputCursor::ReplayingInputCursor):
+ (WebCore::ReplayingInputCursor::create):
+ (WebCore::ReplayingInputCursor::loadInput):
+ * replay/ReplayingInputCursor.h:
+ * replay/SegmentedInputStorage.cpp:
+ (WebCore::SegmentedInputStorage::store):
+ (WebCore::SegmentedInputStorage::queue):
+ (WebCore::SegmentedInputStorage::SegmentedInputStorage): Deleted.
+ * replay/SegmentedInputStorage.h:
+
2015-01-16 Andreas Kling <[email protected]>
Remove assertion that Page::m_editorClient is non-null.
Modified: trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp (178602 => 178603)
--- trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -118,10 +118,10 @@
LOG(WebReplay, "%-25s Writing %5zu: %s\n", "[SerializeInput]", index, input->type().ascii().data());
if (RefPtr<Inspector::Protocol::Replay::ReplayInput> serializedInput = buildInspectorObjectForInput(*input, index))
- m_inputs->addItem(serializedInput.release());
+ m_inputs->addItem(WTF::move(serializedInput));
}
- ReturnType returnValue() { return m_inputs.release(); }
+ ReturnType returnValue() { return WTF::move(m_inputs); }
private:
RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Replay::ReplayInput>> m_inputs;
};
@@ -214,10 +214,8 @@
m_page.replayController().willDispatchEvent(event, frame);
}
-void InspectorReplayAgent::sessionCreated(PassRefPtr<ReplaySession> prpSession)
+void InspectorReplayAgent::sessionCreated(RefPtr<ReplaySession>&& session)
{
- RefPtr<ReplaySession> session = prpSession;
-
auto result = m_sessionsMap.add(session->identifier(), session);
// Can't have two sessions with same identifier.
ASSERT_UNUSED(result, result.isNewEntry);
@@ -225,25 +223,21 @@
m_frontendDispatcher->sessionCreated(session->identifier());
}
-void InspectorReplayAgent::sessionModified(PassRefPtr<ReplaySession> session)
+void InspectorReplayAgent::sessionModified(RefPtr<ReplaySession>&& session)
{
m_frontendDispatcher->sessionModified(session->identifier());
}
-void InspectorReplayAgent::sessionLoaded(PassRefPtr<ReplaySession> prpSession)
+void InspectorReplayAgent::sessionLoaded(RefPtr<ReplaySession>&& session)
{
- RefPtr<ReplaySession> session = prpSession;
-
// In case we didn't know about the loaded session, add here.
m_sessionsMap.add(session->identifier(), session);
m_frontendDispatcher->sessionLoaded(session->identifier());
}
-void InspectorReplayAgent::segmentCreated(PassRefPtr<ReplaySessionSegment> prpSegment)
+void InspectorReplayAgent::segmentCreated(RefPtr<ReplaySessionSegment>&& segment)
{
- RefPtr<ReplaySessionSegment> segment = prpSegment;
-
auto result = m_segmentsMap.add(segment->identifier(), segment);
// Can't have two segments with the same identifier.
ASSERT_UNUSED(result, result.isNewEntry);
@@ -251,17 +245,15 @@
m_frontendDispatcher->segmentCreated(segment->identifier());
}
-void InspectorReplayAgent::segmentCompleted(PassRefPtr<ReplaySessionSegment> segment)
+void InspectorReplayAgent::segmentCompleted(RefPtr<ReplaySessionSegment>&& segment)
{
m_frontendDispatcher->segmentCompleted(segment->identifier());
}
-void InspectorReplayAgent::segmentLoaded(PassRefPtr<ReplaySessionSegment> prpSegment)
+void InspectorReplayAgent::segmentLoaded(RefPtr<ReplaySessionSegment>&& segment)
{
- RefPtr<ReplaySessionSegment> segment = prpSegment;
-
// In case we didn't know about the loaded segment, add here.
- m_segmentsMap.add(segment->identifier(), segment);
+ m_segmentsMap.add(segment->identifier(), segment.copyRef());
m_frontendDispatcher->segmentLoaded(segment->identifier());
}
@@ -384,7 +376,7 @@
void InspectorReplayAgent::switchSession(ErrorString& errorString, Inspector::Protocol::Replay::SessionIdentifier identifier)
{
- ASSERT(identifier > 0);
+ ASSERT_ARG(identifier, identifier > 0);
if (sessionState() != WebCore::SessionState::Inactive) {
errorString = ASCIILiteral("Can't switch sessions unless the session is neither capturing or replaying.");
@@ -395,14 +387,14 @@
if (!session)
return;
- m_page.replayController().switchSession(session);
+ m_page.replayController().switchSession(WTF::move(session));
}
void InspectorReplayAgent::insertSessionSegment(ErrorString& errorString, Inspector::Protocol::Replay::SessionIdentifier sessionIdentifier, SegmentIdentifier segmentIdentifier, int segmentIndex)
{
- ASSERT(sessionIdentifier > 0);
- ASSERT(segmentIdentifier > 0);
- ASSERT(segmentIndex >= 0);
+ ASSERT_ARG(sessionIdentifier, sessionIdentifier > 0);
+ ASSERT_ARG(segmentIdentifier, segmentIdentifier > 0);
+ ASSERT_ARG(segmentIndex, segmentIndex >= 0);
RefPtr<ReplaySession> session = findSession(errorString, sessionIdentifier);
RefPtr<ReplaySessionSegment> segment = findSegment(errorString, segmentIdentifier);
@@ -420,14 +412,14 @@
return;
}
- session->insertSegment(segmentIndex, segment);
- sessionModified(session);
+ session->insertSegment(segmentIndex, WTF::move(segment));
+ sessionModified(WTF::move(session));
}
void InspectorReplayAgent::removeSessionSegment(ErrorString& errorString, Inspector::Protocol::Replay::SessionIdentifier identifier, int segmentIndex)
{
- ASSERT(identifier > 0);
- ASSERT(segmentIndex >= 0);
+ ASSERT_ARG(identifier, identifier > 0);
+ ASSERT_ARG(segmentIndex, segmentIndex >= 0);
RefPtr<ReplaySession> session = findSession(errorString, identifier);
@@ -445,12 +437,12 @@
}
session->removeSegment(segmentIndex);
- sessionModified(session);
+ sessionModified(WTF::move(session));
}
-PassRefPtr<ReplaySession> InspectorReplayAgent::findSession(ErrorString& errorString, SessionIdentifier identifier)
+RefPtr<ReplaySession> InspectorReplayAgent::findSession(ErrorString& errorString, SessionIdentifier identifier)
{
- ASSERT(identifier > 0);
+ ASSERT_ARG(identifier, identifier > 0);
auto it = m_sessionsMap.find(identifier);
if (it == m_sessionsMap.end()) {
@@ -461,9 +453,9 @@
return it->value;
}
-PassRefPtr<ReplaySessionSegment> InspectorReplayAgent::findSegment(ErrorString& errorString, SegmentIdentifier identifier)
+RefPtr<ReplaySessionSegment> InspectorReplayAgent::findSegment(ErrorString& errorString, SegmentIdentifier identifier)
{
- ASSERT(identifier > 0);
+ ASSERT_ARG(identifier, identifier > 0);
auto it = m_segmentsMap.find(identifier);
if (it == m_segmentsMap.end()) {
Modified: trunk/Source/WebCore/inspector/InspectorReplayAgent.h (178602 => 178603)
--- trunk/Source/WebCore/inspector/InspectorReplayAgent.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/inspector/InspectorReplayAgent.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -73,14 +73,14 @@
void willDispatchEvent(const Event&, Frame*);
// Notifications from ReplayController.
- void sessionCreated(PassRefPtr<ReplaySession>);
+ void sessionCreated(RefPtr<ReplaySession>&&);
// This is called internally (when adding/removing) and by ReplayController during capture.
- void sessionModified(PassRefPtr<ReplaySession>);
- void sessionLoaded(PassRefPtr<ReplaySession>);
+ void sessionModified(RefPtr<ReplaySession>&&);
+ void sessionLoaded(RefPtr<ReplaySession>&&);
- void segmentCreated(PassRefPtr<ReplaySessionSegment>);
- void segmentCompleted(PassRefPtr<ReplaySessionSegment>);
- void segmentLoaded(PassRefPtr<ReplaySessionSegment>);
+ void segmentCreated(RefPtr<ReplaySessionSegment>&&);
+ void segmentCompleted(RefPtr<ReplaySessionSegment>&&);
+ void segmentLoaded(RefPtr<ReplaySessionSegment>&&);
void segmentUnloaded();
void captureStarted();
@@ -110,8 +110,8 @@
virtual void getSegmentData(ErrorString&, Inspector::Protocol::Replay::SegmentIdentifier, RefPtr<Inspector::Protocol::Replay::SessionSegment>&) override;
private:
- PassRefPtr<ReplaySession> findSession(ErrorString&, SessionIdentifier);
- PassRefPtr<ReplaySessionSegment> findSegment(ErrorString&, SegmentIdentifier);
+ RefPtr<ReplaySession> findSession(ErrorString&, SessionIdentifier);
+ RefPtr<ReplaySessionSegment> findSegment(ErrorString&, SegmentIdentifier);
WebCore::SessionState sessionState() const;
std::unique_ptr<Inspector::InspectorReplayFrontendDispatcher> m_frontendDispatcher;
Modified: trunk/Source/WebCore/replay/CapturingInputCursor.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/CapturingInputCursor.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/CapturingInputCursor.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -38,8 +38,8 @@
namespace WebCore {
-CapturingInputCursor::CapturingInputCursor(PassRefPtr<ReplaySessionSegment> segment)
- : m_segment(segment)
+CapturingInputCursor::CapturingInputCursor(RefPtr<ReplaySessionSegment>&& segment)
+ : m_segment(WTF::move(segment))
{
LOG(WebReplay, "%-30sCreated capture cursor=%p.\n", "[ReplayController]", this);
}
@@ -49,9 +49,9 @@
LOG(WebReplay, "%-30sDestroyed capture cursor=%p.\n", "[ReplayController]", this);
}
-Ref<CapturingInputCursor> CapturingInputCursor::create(PassRefPtr<ReplaySessionSegment> segment)
+Ref<CapturingInputCursor> CapturingInputCursor::create(RefPtr<ReplaySessionSegment>&& segment)
{
- return adoptRef(*new CapturingInputCursor(segment));
+ return adoptRef(*new CapturingInputCursor(WTF::move(segment)));
}
void CapturingInputCursor::storeInput(std::unique_ptr<NondeterministicInputBase> input)
@@ -67,7 +67,7 @@
m_segment->storage().store(WTF::move(input));
}
-NondeterministicInputBase* CapturingInputCursor::loadInput(InputQueue, const AtomicString&)
+NondeterministicInputBase* CapturingInputCursor::loadInput(InputQueue, const String&)
{
// Can't load inputs from capturing cursor.
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/replay/CapturingInputCursor.h (178602 => 178603)
--- trunk/Source/WebCore/replay/CapturingInputCursor.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/CapturingInputCursor.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -32,6 +32,7 @@
#include <replay/InputCursor.h>
#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -42,17 +43,17 @@
class CapturingInputCursor final : public InputCursor {
WTF_MAKE_NONCOPYABLE(CapturingInputCursor);
public:
- static Ref<CapturingInputCursor> create(PassRefPtr<ReplaySessionSegment>);
+ static Ref<CapturingInputCursor> create(RefPtr<ReplaySessionSegment>&&);
virtual ~CapturingInputCursor();
virtual bool isCapturing() const override { return true; }
virtual bool isReplaying() const override { return false; }
protected:
- virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString& type) override;
+ virtual NondeterministicInputBase* loadInput(InputQueue, const String& type) override;
private:
- CapturingInputCursor(PassRefPtr<ReplaySessionSegment>);
+ CapturingInputCursor(RefPtr<ReplaySessionSegment>&&);
virtual NondeterministicInputBase* uncheckedLoadInput(InputQueue) override;
virtual void storeInput(std::unique_ptr<NondeterministicInputBase>) override;
Modified: trunk/Source/WebCore/replay/EventLoopInputDispatcher.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/EventLoopInputDispatcher.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/EventLoopInputDispatcher.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -49,11 +49,7 @@
, m_client(client)
, m_cursor(cursor)
, m_timer(*this, &EventLoopInputDispatcher::timerFired)
- , m_dispatching(false)
- , m_running(false)
, m_speed(DispatchSpeed::FastForward)
- , m_previousDispatchStartTime(0.0)
- , m_previousInputTimestamp(0.0)
{
m_currentWork.input = nullptr;
m_currentWork.timestamp = 0.0;
Modified: trunk/Source/WebCore/replay/EventLoopInputDispatcher.h (178602 => 178603)
--- trunk/Source/WebCore/replay/EventLoopInputDispatcher.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/EventLoopInputDispatcher.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -82,15 +82,15 @@
// This data is valid when an event loop input is presently dispatching.
EventLoopInputData m_currentWork;
// Whether the dispatcher is currently calling out to an inputs' dispatch() method.
- bool m_dispatching;
+ bool m_dispatching {false};
// Whether the dispatcher is waiting to dispatch or actively dispatching inputs.
- bool m_running;
+ bool m_running {false};
DispatchSpeed m_speed;
// The time at which the last input dispatch() method was called.
- double m_previousDispatchStartTime;
+ double m_previousDispatchStartTime {0.0};
// The timestamp specified by the last dispatched input.
- double m_previousInputTimestamp;
+ double m_previousInputTimestamp {0.0};
};
} // namespace WebCore
Modified: trunk/Source/WebCore/replay/FunctorInputCursor.h (178602 => 178603)
--- trunk/Source/WebCore/replay/FunctorInputCursor.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/FunctorInputCursor.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -43,9 +43,9 @@
class FunctorInputCursor final : public InputCursor {
WTF_MAKE_NONCOPYABLE(FunctorInputCursor);
public:
- static PassRefPtr<FunctorInputCursor> create(PassRefPtr<ReplaySessionSegment> segment)
+ static Ref<FunctorInputCursor> create(RefPtr<ReplaySessionSegment>&& segment)
{
- return adoptRef(new FunctorInputCursor(segment));
+ return adoptRef(*new FunctorInputCursor(WTF::move(segment)));
}
// InputCursor
@@ -58,9 +58,9 @@
template<typename Functor>
typename Functor::ReturnType forEachInputInQueue(InputQueue, Functor&);
protected:
- virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString&) override;
+ virtual NondeterministicInputBase* loadInput(InputQueue, const String&) override;
private:
- FunctorInputCursor(PassRefPtr<ReplaySessionSegment>);
+ FunctorInputCursor(RefPtr<ReplaySessionSegment>&&);
RefPtr<ReplaySessionSegment> m_segment;
};
@@ -74,8 +74,8 @@
return functor.returnValue();
}
-inline FunctorInputCursor::FunctorInputCursor(PassRefPtr<ReplaySessionSegment> segment)
- : m_segment(segment)
+inline FunctorInputCursor::FunctorInputCursor(RefPtr<ReplaySessionSegment>&& segment)
+ : m_segment(WTF::move(segment))
{
}
@@ -84,7 +84,7 @@
ASSERT_NOT_REACHED();
}
-inline NondeterministicInputBase* FunctorInputCursor::loadInput(InputQueue, const AtomicString&)
+inline NondeterministicInputBase* FunctorInputCursor::loadInput(InputQueue, const String&)
{
ASSERT_NOT_REACHED();
return nullptr;
Modified: trunk/Source/WebCore/replay/ReplayController.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplayController.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplayController.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -113,10 +113,8 @@
ReplayController::ReplayController(Page& page)
: m_page(page)
- , m_loadedSegment(nullptr)
, m_loadedSession(ReplaySession::create())
, m_emptyCursor(EmptyInputCursor::create())
- , m_activeCursor(nullptr)
, m_targetPosition(ReplayPosition(0, 0))
, m_currentPosition(ReplayPosition(0, 0))
, m_segmentState(SegmentState::Unloaded)
@@ -127,7 +125,7 @@
void ReplayController::setForceDeterministicSettings(bool shouldForceDeterministicBehavior)
{
- ASSERT(shouldForceDeterministicBehavior ^ (m_sessionState == SessionState::Inactive));
+ ASSERT_ARG(shouldForceDeterministicBehavior, shouldForceDeterministicBehavior ^ (m_sessionState == SessionState::Inactive));
if (shouldForceDeterministicBehavior) {
m_savedSettings.usesPageCache = m_page.settings().usesPageCache();
@@ -145,7 +143,7 @@
void ReplayController::setSessionState(SessionState state)
{
- ASSERT(state != m_sessionState);
+ ASSERT_ARG(state, state != m_sessionState);
LOG(WebReplay, "%-20s SessionState transition: %10s --> %10s.\n", "ReplayController", sessionStateToString(m_sessionState), sessionStateToString(state));
@@ -173,7 +171,7 @@
void ReplayController::setSegmentState(SegmentState state)
{
- ASSERT(state != m_segmentState);
+ ASSERT_ARG(state, state != m_segmentState);
LOG(WebReplay, "%-20s SegmentState transition: %10s --> %10s.\n", "ReplayController", segmentStateToString(m_segmentState), segmentStateToString(state));
@@ -198,8 +196,9 @@
m_segmentState = state;
}
-void ReplayController::switchSession(PassRefPtr<ReplaySession> session)
+void ReplayController::switchSession(RefPtr<ReplaySession>&& session)
{
+ ASSERT_ARG(session, session);
ASSERT(m_segmentState == SegmentState::Unloaded);
ASSERT(m_sessionState == SessionState::Inactive);
@@ -225,7 +224,7 @@
LOG(WebReplay, "%-20s Created segment: %p.\n", "ReplayController", m_loadedSegment.get());
InspectorInstrumentation::segmentCreated(m_page, m_loadedSegment.copyRef());
- m_activeCursor = CapturingInputCursor::create(m_loadedSegment);
+ m_activeCursor = CapturingInputCursor::create(m_loadedSegment.copyRef());
m_activeCursor->appendInput<BeginSegmentSentinel>();
std::unique_ptr<InitialNavigation> navigationInput = InitialNavigation::createFromPage(m_page);
@@ -249,13 +248,13 @@
LOG(WebReplay, "%-20s Completed segment: %p.\n", "ReplayController", segment.get());
InspectorInstrumentation::segmentCompleted(m_page, segment.copyRef());
- m_loadedSession->appendSegment(segment);
+ m_loadedSession->appendSegment(segment.copyRef());
InspectorInstrumentation::sessionModified(m_page, m_loadedSession.copyRef());
}
void ReplayController::loadSegmentAtIndex(size_t segmentIndex)
{
- ASSERT(segmentIndex < m_loadedSession->size());
+ ASSERT_ARG(segmentIndex, segmentIndex >= 0 && segmentIndex < m_loadedSession->size());
RefPtr<ReplaySessionSegment> segment = m_loadedSession->at(segmentIndex);
ASSERT(m_sessionState == SessionState::Replaying);
@@ -269,7 +268,7 @@
m_currentPosition.segmentOffset = segmentIndex;
m_currentPosition.inputOffset = 0;
- m_activeCursor = ReplayingInputCursor::create(m_loadedSegment, m_page, this);
+ m_activeCursor = ReplayingInputCursor::create(m_loadedSegment.copyRef(), m_page, this);
LOG(WebReplay, "%-20sLoading segment: %p.\n", "ReplayController", segment.get());
InspectorInstrumentation::segmentLoaded(m_page, segment.copyRef());
@@ -287,8 +286,8 @@
m_activeCursor = nullptr;
RefPtr<ReplaySessionSegment> unloadedSegment = m_loadedSegment.release();
for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
- frame->script().globalObject(mainThreadNormalWorld())->setInputCursor(m_emptyCursor);
- frame->document()->setInputCursor(m_emptyCursor);
+ frame->script().globalObject(mainThreadNormalWorld())->setInputCursor(m_emptyCursor.copyRef());
+ frame->document()->setInputCursor(m_emptyCursor.copyRef());
}
// When we stop capturing, don't send out segment unloaded events since we
@@ -407,7 +406,8 @@
void ReplayController::frameNavigated(DocumentLoader* loader)
{
ASSERT(m_sessionState != SessionState::Inactive);
-
+ ASSERT_ARG(loader, loader);
+
// The initial capturing segment is created prior to main frame navigation.
// Otherwise, the prior capturing segment was completed when the frame detached,
// and it is now time to create a new segment.
@@ -478,27 +478,26 @@
#endif
}
-PassRefPtr<ReplaySession> ReplayController::loadedSession() const
+RefPtr<ReplaySession> ReplayController::loadedSession() const
{
- return m_loadedSession;
+ return m_loadedSession.copyRef();
}
-PassRefPtr<ReplaySessionSegment> ReplayController::loadedSegment() const
+RefPtr<ReplaySessionSegment> ReplayController::loadedSegment() const
{
- return m_loadedSegment;
+ return m_loadedSegment.copyRef();
}
-InputCursor& ReplayController::activeInputCursor() const
+InputCursor& ReplayController::activeInputCursor()
{
- return m_activeCursor ? *m_activeCursor : *m_emptyCursor;
+ return m_activeCursor ? *m_activeCursor : m_emptyCursor.get();
}
EventLoopInputDispatcher& ReplayController::dispatcher() const
{
ASSERT(m_sessionState == SessionState::Replaying);
ASSERT(m_segmentState == SegmentState::Dispatching);
- ASSERT(m_activeCursor);
- ASSERT(m_activeCursor->isReplaying());
+ ASSERT(m_activeCursor && m_activeCursor->isReplaying());
return static_cast<ReplayingInputCursor&>(*m_activeCursor).dispatcher();
}
Modified: trunk/Source/WebCore/replay/ReplayController.h (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplayController.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplayController.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -128,7 +128,7 @@
replayToPosition(ReplayPosition(), speed);
}
- void switchSession(PassRefPtr<ReplaySession>);
+ void switchSession(RefPtr<ReplaySession>&&);
// InspectorReplayAgent notifications.
void frameNavigated(DocumentLoader*);
@@ -140,10 +140,10 @@
SessionState sessionState() const { return m_sessionState; }
SegmentState segmentState() const { return m_segmentState; }
- PassRefPtr<ReplaySession> loadedSession() const;
- PassRefPtr<ReplaySessionSegment> loadedSegment() const;
+ RefPtr<ReplaySession> loadedSession() const;
+ RefPtr<ReplaySessionSegment> loadedSegment() const;
- JSC::InputCursor& activeInputCursor() const;
+ JSC::InputCursor& activeInputCursor();
ReplayPosition currentPosition() const { return m_currentPosition; }
private:
@@ -176,7 +176,7 @@
RefPtr<ReplaySessionSegment> m_loadedSegment;
RefPtr<ReplaySession> m_loadedSession;
- const RefPtr<JSC::InputCursor> m_emptyCursor;
+ Ref<JSC::InputCursor> m_emptyCursor;
// The active cursor is set to nullptr when invalid.
RefPtr<JSC::InputCursor> m_activeCursor;
Modified: trunk/Source/WebCore/replay/ReplaySession.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplaySession.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplaySession.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -37,9 +37,9 @@
static unsigned s_nextIdentifier = 1;
-PassRefPtr<ReplaySession> ReplaySession::create()
+Ref<ReplaySession> ReplaySession::create()
{
- return adoptRef(new ReplaySession());
+ return adoptRef(*new ReplaySession());
}
ReplaySession::ReplaySession()
@@ -52,35 +52,39 @@
{
}
-PassRefPtr<ReplaySessionSegment> ReplaySession::at(size_t position) const
+RefPtr<ReplaySessionSegment> ReplaySession::at(size_t position) const
{
- return m_segments.at(position);
+ ASSERT_ARG(position, position >= 0 && position < m_segments.size());
+
+ return m_segments.at(position).copyRef();
}
-void ReplaySession::appendSegment(PassRefPtr<ReplaySessionSegment> prpSegment)
+void ReplaySession::appendSegment(RefPtr<ReplaySessionSegment>&& segment)
{
- RefPtr<ReplaySessionSegment> segment = prpSegment;
-
+ ASSERT_ARG(segment, segment);
// For now, only support one segment.
ASSERT(!m_segments.size());
// Since replay locations are specified with segment IDs, we can only
// have one instance of a segment in the session.
- size_t offset = m_segments.find(segment);
+ size_t offset = m_segments.find(segment.copyRef());
ASSERT_UNUSED(offset, offset == notFound);
- m_segments.append(segment.release());
+ m_segments.append(WTF::move(segment));
}
-void ReplaySession::insertSegment(size_t position, PassRefPtr<ReplaySessionSegment> segment)
+void ReplaySession::insertSegment(size_t position, RefPtr<ReplaySessionSegment>&& segment)
{
- ASSERT(position < m_segments.size());
- m_segments.insert(position, segment);
+ ASSERT_ARG(segment, segment);
+ ASSERT_ARG(position, position >= 0 && position < m_segments.size());
+
+ m_segments.insert(position, WTF::move(segment));
}
void ReplaySession::removeSegment(size_t position)
{
- ASSERT(position < m_segments.size());
+ ASSERT_ARG(position, position >= 0 && position < m_segments.size());
+
m_segments.remove(position);
}
Modified: trunk/Source/WebCore/replay/ReplaySession.h (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplaySession.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplaySession.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -43,20 +43,20 @@
class ReplaySession : public RefCounted<ReplaySession> {
WTF_MAKE_NONCOPYABLE(ReplaySession);
public:
- static PassRefPtr<ReplaySession> create();
+ static Ref<ReplaySession> create();
~ReplaySession();
double timestamp() const { return m_timestamp; }
unsigned identifier() const { return m_identifier; }
size_t size() const { return m_segments.size(); }
- PassRefPtr<ReplaySessionSegment> at(size_t position) const;
+ RefPtr<ReplaySessionSegment> at(size_t position) const;
SegmentIterator begin() const { return m_segments.begin(); }
SegmentIterator end() const { return m_segments.end(); }
- void appendSegment(PassRefPtr<ReplaySessionSegment>);
- void insertSegment(size_t position, PassRefPtr<ReplaySessionSegment>);
+ void appendSegment(RefPtr<ReplaySessionSegment>&&);
+ void insertSegment(size_t position, RefPtr<ReplaySessionSegment>&&);
void removeSegment(size_t position);
private:
Modified: trunk/Source/WebCore/replay/ReplaySessionSegment.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplaySessionSegment.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplaySessionSegment.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -35,22 +35,20 @@
#include "ReplayingInputCursor.h"
#include "SegmentedInputStorage.h"
#include <wtf/CurrentTime.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
static unsigned s_nextSegmentIdentifier = 1;
-PassRefPtr<ReplaySessionSegment> ReplaySessionSegment::create()
+Ref<ReplaySessionSegment> ReplaySessionSegment::create()
{
- return adoptRef(new ReplaySessionSegment);
+ return adoptRef(*new ReplaySessionSegment);
}
ReplaySessionSegment::ReplaySessionSegment()
: m_storage(std::make_unique<SegmentedInputStorage>())
, m_identifier(s_nextSegmentIdentifier++)
- , m_canCapture(true)
, m_timestamp(currentTimeMS())
{
}
Modified: trunk/Source/WebCore/replay/ReplaySessionSegment.h (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplaySessionSegment.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplaySessionSegment.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -48,7 +48,7 @@
friend class FunctorInputCursor;
friend class ReplayingInputCursor;
public:
- static PassRefPtr<ReplaySessionSegment> create();
+ static Ref<ReplaySessionSegment> create();
~ReplaySessionSegment();
unsigned identifier() const { return m_identifier; }
@@ -64,7 +64,7 @@
Vector<double, 0> m_eventLoopTimings;
unsigned m_identifier;
- bool m_canCapture;
+ bool m_canCapture {true};
double m_timestamp;
};
Modified: trunk/Source/WebCore/replay/ReplayingInputCursor.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplayingInputCursor.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplayingInputCursor.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -39,8 +39,8 @@
namespace WebCore {
-ReplayingInputCursor::ReplayingInputCursor(PassRefPtr<ReplaySessionSegment> segment, Page& page, EventLoopInputDispatcherClient* client)
- : m_segment(segment)
+ReplayingInputCursor::ReplayingInputCursor(RefPtr<ReplaySessionSegment>&& segment, Page& page, EventLoopInputDispatcherClient* client)
+ : m_segment(WTF::move(segment))
, m_dispatcher(std::make_unique<EventLoopInputDispatcher>(page, *this, client))
{
for (size_t i = 0; i < static_cast<size_t>(InputQueue::Count); i++)
@@ -51,9 +51,9 @@
{
}
-PassRefPtr<ReplayingInputCursor> ReplayingInputCursor::create(PassRefPtr<ReplaySessionSegment> segment, Page& page, EventLoopInputDispatcherClient* client)
+Ref<ReplayingInputCursor> ReplayingInputCursor::create(RefPtr<ReplaySessionSegment>&& segment, Page& page, EventLoopInputDispatcherClient* client)
{
- return adoptRef(new ReplayingInputCursor(segment, page, client));
+ return adoptRef(*new ReplayingInputCursor(WTF::move(segment), page, client));
}
void ReplayingInputCursor::storeInput(std::unique_ptr<NondeterministicInputBase>)
@@ -62,12 +62,12 @@
ASSERT_NOT_REACHED();
}
-NondeterministicInputBase* ReplayingInputCursor::loadInput(InputQueue queue, const AtomicString& type)
+NondeterministicInputBase* ReplayingInputCursor::loadInput(InputQueue queue, const String& type)
{
NondeterministicInputBase* input = uncheckedLoadInput(queue);
if (input->type() != type) {
- LOG_ERROR("%-25s ERROR: Expected replay input of type %s, but got type %s\n", "[ReplayingInputCursor]", type.string().ascii().data(), input->type().ascii().data());
+ LOG_ERROR("%-25s ERROR: Expected replay input of type %s, but got type %s\n", "[ReplayingInputCursor]", type.ascii().data(), input->type().ascii().data());
return nullptr;
}
Modified: trunk/Source/WebCore/replay/ReplayingInputCursor.h (178602 => 178603)
--- trunk/Source/WebCore/replay/ReplayingInputCursor.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/ReplayingInputCursor.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -32,7 +32,6 @@
#include <replay/InputCursor.h>
#include <wtf/Vector.h>
-#include <wtf/text/AtomicString.h>
namespace WebCore {
@@ -50,7 +49,7 @@
class ReplayingInputCursor final : public InputCursor {
WTF_MAKE_NONCOPYABLE(ReplayingInputCursor);
public:
- static PassRefPtr<ReplayingInputCursor> create(PassRefPtr<ReplaySessionSegment>, Page&, EventLoopInputDispatcherClient*);
+ static Ref<ReplayingInputCursor> create(RefPtr<ReplaySessionSegment>&&, Page&, EventLoopInputDispatcherClient*);
virtual ~ReplayingInputCursor();
virtual bool isCapturing() const override { return false; }
@@ -60,9 +59,9 @@
EventLoopInputData loadEventLoopInput();
protected:
- virtual NondeterministicInputBase* loadInput(InputQueue, const AtomicString& type) override;
+ virtual NondeterministicInputBase* loadInput(InputQueue, const String& type) override;
private:
- ReplayingInputCursor(PassRefPtr<ReplaySessionSegment>, Page&, EventLoopInputDispatcherClient*);
+ ReplayingInputCursor(RefPtr<ReplaySessionSegment>&&, Page&, EventLoopInputDispatcherClient*);
virtual void storeInput(std::unique_ptr<NondeterministicInputBase>) override;
virtual NondeterministicInputBase* uncheckedLoadInput(InputQueue) override;
Modified: trunk/Source/WebCore/replay/SegmentedInputStorage.cpp (178602 => 178603)
--- trunk/Source/WebCore/replay/SegmentedInputStorage.cpp 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/SegmentedInputStorage.cpp 2015-01-16 22:13:08 UTC (rev 178603)
@@ -74,7 +74,6 @@
}
SegmentedInputStorage::SegmentedInputStorage()
- : m_inputCount(0)
{
for (size_t i = 0; i < offsetForInputQueue(InputQueue::Count); i++)
m_queues.append(new QueuedInputs);
@@ -100,8 +99,8 @@
void SegmentedInputStorage::store(std::unique_ptr<NondeterministicInputBase> input)
{
- ASSERT(input);
- ASSERT(input->queue() < InputQueue::Count);
+ ASSERT_ARG(input, input);
+ ASSERT_ARG(input, input->queue() < InputQueue::Count);
LOG(WebReplay, "%-14s#%-5u %s: %s %s\n", "ReplayEvents", m_inputCount++, queueTypeToLogPrefix(input->queue(), false), input->type().utf8().data(), jsonStringForInput(*input).utf8().data());
@@ -115,7 +114,7 @@
const SegmentedInputStorage::QueuedInputs& SegmentedInputStorage::queue(InputQueue queue) const
{
- ASSERT(queue < InputQueue::Count);
+ ASSERT_ARG(queue, queue < InputQueue::Count);
return *m_queues.at(offsetForInputQueue(queue));
}
Modified: trunk/Source/WebCore/replay/SegmentedInputStorage.h (178602 => 178603)
--- trunk/Source/WebCore/replay/SegmentedInputStorage.h 2015-01-16 22:05:56 UTC (rev 178602)
+++ trunk/Source/WebCore/replay/SegmentedInputStorage.h 2015-01-16 22:13:08 UTC (rev 178603)
@@ -52,7 +52,7 @@
const QueuedInputs& queue(InputQueue) const;
Vector<QueuedInputs*, 3> m_queues;
- unsigned m_inputCount;
+ unsigned m_inputCount {0};
};
} // namespace WebCore