Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / DocumentMarker.cpp
index 5796c8e..f1a12bb 100644 (file)
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/dom/DocumentMarker.h"
 
-namespace WebCore {
+namespace blink {
 
 DocumentMarkerDetails::~DocumentMarkerDetails()
 {
@@ -39,13 +39,13 @@ DocumentMarkerDetails::~DocumentMarkerDetails()
 
 class DocumentMarkerDescription FINAL : public DocumentMarkerDetails {
 public:
-    static PassRefPtr<DocumentMarkerDescription> create(const String&);
+    static PassRefPtrWillBeRawPtr<DocumentMarkerDescription> create(const String&);
 
     const String& description() const { return m_description; }
     virtual bool isDescription() const OVERRIDE { return true; }
 
 private:
-    DocumentMarkerDescription(const String& description)
+    explicit DocumentMarkerDescription(const String& description)
         : m_description(description)
     {
     }
@@ -53,9 +53,9 @@ private:
     String m_description;
 };
 
-PassRefPtr<DocumentMarkerDescription> DocumentMarkerDescription::create(const String& description)
+PassRefPtrWillBeRawPtr<DocumentMarkerDescription> DocumentMarkerDescription::create(const String& description)
 {
-    return adoptRef(new DocumentMarkerDescription(description));
+    return adoptRefWillBeNoop(new DocumentMarkerDescription(description));
 }
 
 inline DocumentMarkerDescription* toDocumentMarkerDescription(DocumentMarkerDetails* details)
@@ -68,7 +68,7 @@ inline DocumentMarkerDescription* toDocumentMarkerDescription(DocumentMarkerDeta
 
 class DocumentMarkerTextMatch FINAL : public DocumentMarkerDetails {
 public:
-    static PassRefPtr<DocumentMarkerTextMatch> instanceFor(bool);
+    static PassRefPtrWillBeRawPtr<DocumentMarkerTextMatch> instanceFor(bool);
 
     bool activeMatch() const { return m_match; }
     virtual bool isTextMatch() const OVERRIDE { return true; }
@@ -82,10 +82,10 @@ private:
     bool m_match;
 };
 
-PassRefPtr<DocumentMarkerTextMatch> DocumentMarkerTextMatch::instanceFor(bool match)
+PassRefPtrWillBeRawPtr<DocumentMarkerTextMatch> DocumentMarkerTextMatch::instanceFor(bool match)
 {
-    DEFINE_STATIC_REF(DocumentMarkerTextMatch, trueInstance, (adoptRef(new DocumentMarkerTextMatch(true))));
-    DEFINE_STATIC_REF(DocumentMarkerTextMatch, falseInstance, (adoptRef(new DocumentMarkerTextMatch(false))));
+    DEFINE_STATIC_REF_WILL_BE_PERSISTENT(DocumentMarkerTextMatch, trueInstance, (adoptRefWillBeNoop(new DocumentMarkerTextMatch(true))));
+    DEFINE_STATIC_REF_WILL_BE_PERSISTENT(DocumentMarkerTextMatch, falseInstance, (adoptRefWillBeNoop(new DocumentMarkerTextMatch(false))));
     return match ? trueInstance : falseInstance;
 }
 
@@ -117,7 +117,7 @@ DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned e
     : m_type(type)
     , m_startOffset(startOffset)
     , m_endOffset(endOffset)
-    , m_details(description.isEmpty() ? 0 : DocumentMarkerDescription::create(description))
+    , m_details(description.isEmpty() ? nullptr : DocumentMarkerDescription::create(description))
     , m_hash(0)
 {
 }
@@ -126,7 +126,7 @@ DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned e
     : m_type(type)
     , m_startOffset(startOffset)
     , m_endOffset(endOffset)
-    , m_details(description.isEmpty() ? 0 : DocumentMarkerDescription::create(description))
+    , m_details(description.isEmpty() ? nullptr : DocumentMarkerDescription::create(description))
     , m_hash(hash)
 {
 }
@@ -140,7 +140,7 @@ DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool ac
 {
 }
 
-DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset, PassRefPtr<DocumentMarkerDetails> details)
+DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset, PassRefPtrWillBeRawPtr<DocumentMarkerDetails> details)
     : m_type(type)
     , m_startOffset(startOffset)
     , m_endOffset(endOffset)
@@ -149,6 +149,15 @@ DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned e
 {
 }
 
+DocumentMarker::DocumentMarker(const DocumentMarker& marker)
+    : m_type(marker.type())
+    , m_startOffset(marker.startOffset())
+    , m_endOffset(marker.endOffset())
+    , m_details(marker.details())
+    , m_hash(marker.hash())
+{
+}
+
 void DocumentMarker::shiftOffsets(int delta)
 {
     m_startOffset += delta;
@@ -174,4 +183,9 @@ bool DocumentMarker::activeMatch() const
     return false;
 }
 
-} // namespace WebCore
+void DocumentMarker::trace(Visitor* visitor)
+{
+    visitor->trace(m_details);
+}
+
+} // namespace blink