Title: [136319] trunk
Revision
136319
Author
[email protected]
Date
2012-12-02 01:45:48 -0800 (Sun, 02 Dec 2012)

Log Message

Unreviewed, rolling out r136236.
http://trac.webkit.org/changeset/136236
https://bugs.webkit.org/show_bug.cgi?id=103833

[chromium] Flakey crashes in SpeechRecognitionEvent::emma
during GC. (Requested by mkwst on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-12-02

Source/WebCore:

* Modules/speech/SpeechRecognition.cpp:
(WebCore::SpeechRecognition::start):
* Modules/speech/SpeechRecognition.h:
(SpeechRecognition):
* Modules/speech/SpeechRecognitionEvent.cpp:
(WebCore::SpeechRecognitionEvent::SpeechRecognitionEvent):
* Modules/speech/SpeechRecognitionEvent.h:
(SpeechRecognitionEventInit):
(SpeechRecognitionEvent):
(WebCore::SpeechRecognitionEvent::resultIndex):
* Modules/speech/SpeechRecognitionEvent.idl:
* Modules/speech/SpeechRecognitionResult.cpp:
(WebCore::emmaQualifiedName):
(WebCore):
(WebCore::SpeechRecognitionResult::emma):
* Modules/speech/SpeechRecognitionResult.h:
(WebCore):
(WebCore::SpeechRecognitionResult::final):
(SpeechRecognitionResult):
* Modules/speech/SpeechRecognitionResult.idl:
* WebCore.gypi:
* bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp: Renamed from Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp.
(WebCore):
(WebCore::V8SpeechRecognitionResult::opaqueRootForGC):

Source/WebKit/chromium:

* public/WebSpeechRecognizerClient.h:
* src/SpeechRecognitionClientProxy.cpp:
* src/SpeechRecognitionClientProxy.h:
(SpeechRecognitionClientProxy):

Tools:

* DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp:

LayoutTests:

* fast/speech/scripted/emma-expected.txt:
* fast/speech/scripted/emma.html:
* fast/speech/scripted/speechrecognition-basics-expected.txt:
* fast/speech/scripted/speechrecognition-basics.html:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136318 => 136319)


--- trunk/LayoutTests/ChangeLog	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/LayoutTests/ChangeLog	2012-12-02 09:45:48 UTC (rev 136319)
@@ -1,3 +1,17 @@
+2012-12-02  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r136236.
+        http://trac.webkit.org/changeset/136236
+        https://bugs.webkit.org/show_bug.cgi?id=103833
+
+        [chromium] Flakey crashes in SpeechRecognitionEvent::emma
+        during GC. (Requested by mkwst on #webkit).
+
+        * fast/speech/scripted/emma-expected.txt:
+        * fast/speech/scripted/emma.html:
+        * fast/speech/scripted/speechrecognition-basics-expected.txt:
+        * fast/speech/scripted/speechrecognition-basics.html:
+
 2012-12-01  Mike West  <[email protected]>
 
         [chromium] Unreviewed gardening. Skipping crashing tests.

Modified: trunk/LayoutTests/fast/speech/scripted/emma-expected.txt (136318 => 136319)


--- trunk/LayoutTests/fast/speech/scripted/emma-expected.txt	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/LayoutTests/fast/speech/scripted/emma-expected.txt	2012-12-02 09:45:48 UTC (rev 136319)
@@ -10,9 +10,9 @@
 onsoundstart
 onspeechstart
 onresult
-PASS event.emma.childNodes.length is 1
-PASS event.emma.firstChild.nodeName is "emma:emma"
-window.emma = event.emma.firstChild
+PASS event.result.emma.childNodes.length is 1
+PASS event.result.emma.firstChild.nodeName is "emma:emma"
+window.emma = event.result.emma.firstChild
 PASS emma.getAttribute("version") is "1.0"
 PASS emma.childNodes.length is 1
 PASS emma.firstChild.nodeName is "emma:one-of"
@@ -38,9 +38,9 @@
 window._oneof_ = null
 window.interpretation = null
 window.literal = null
-event.emma.customProperty = 42
+event.result.emma.customProperty = 42
 gc()
-PASS event.emma.customProperty is 42
+PASS event.result.emma.customProperty is 42
 onspeechend
 onsoundend
 onaudioend

Modified: trunk/LayoutTests/fast/speech/scripted/emma.html (136318 => 136319)


--- trunk/LayoutTests/fast/speech/scripted/emma.html	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/LayoutTests/fast/speech/scripted/emma.html	2012-12-02 09:45:48 UTC (rev 136319)
@@ -27,9 +27,9 @@
 
     r._onresult_ = function() {
         debug('onresult');
-        shouldBe('event.emma.childNodes.length', '1');
-        shouldBeEqualToString('event.emma.firstChild.nodeName', 'emma:emma');
-        evalAndLog('window.emma = event.emma.firstChild');
+        shouldBe('event.result.emma.childNodes.length', '1');
+        shouldBeEqualToString('event.result.emma.firstChild.nodeName', 'emma:emma');
+        evalAndLog('window.emma = event.result.emma.firstChild');
         shouldBeEqualToString('emma.getAttribute("version")', '1.0');
 
         shouldBe('emma.childNodes.length', '1');
@@ -58,9 +58,9 @@
         evalAndLog('window._oneof_ = null');
         evalAndLog('window.interpretation = null');
         evalAndLog('window.literal = null');
-        evalAndLog('event.emma.customProperty = 42');
+        evalAndLog('event.result.emma.customProperty = 42');
         evalAndLog('gc()');
-        shouldBe('event.emma.customProperty', '42');
+        shouldBe('event.result.emma.customProperty', '42');
     }
 
     r._onend_ = function() {

Modified: trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics-expected.txt (136318 => 136319)


--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics-expected.txt	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics-expected.txt	2012-12-02 09:45:48 UTC (rev 136319)
@@ -17,11 +17,9 @@
 PASS count is 3
 onresult
 PASS count is 4
-PASS event.results.length is 1
-PASS event.results[0].length is 1
-PASS event.results[0].isFinal is true
-PASS event.results[0].item(0).transcript is "hello, world"
-PASS event.results[0].item(0).confidence is within 0.001 of 0.42
+PASS event.result.length is 1
+PASS event.result.item(0).transcript is "hello, world"
+PASS event.result.item(0).confidence is within 0.001 of 0.42
 onspeechend
 PASS count is 5
 onsoundend
@@ -42,7 +40,7 @@
 PASS count is 3
 onnomatch
 PASS count is 4
-PASS event.results is null
+PASS event.result is null
 onspeechend
 PASS count is 5
 onsoundend

Modified: trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics.html (136318 => 136319)


--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics.html	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics.html	2012-12-02 09:45:48 UTC (rev 136319)
@@ -29,11 +29,9 @@
         debug('onresult');
         shouldBe('count', '4');
         ++count;
-        shouldBe('event.results.length', '1');
-        shouldBe('event.results[0].length', '1');
-        shouldBe('event.results[0].isFinal', 'true');
-        shouldBeEqualToString('event.results[0].item(0).transcript', 'hello, world');
-        shouldBeCloseTo('event.results[0].item(0).confidence', 0.42, 1e-3);
+        shouldBe('event.result.length', '1');
+        shouldBeEqualToString('event.result.item(0).transcript', 'hello, world');
+        shouldBeCloseTo('event.result.item(0).confidence', 0.42, 1e-3);
     }
 
     r._onspeechend_ =     function() { debug('onspeechend');   shouldBe('count', '5'); ++count; }
@@ -67,7 +65,7 @@
         debug('onnomatch');
         shouldBe('count', '4');
         ++count;
-        shouldBe('event.results', 'null');
+        shouldBe('event.result', 'null');
     }
 
     r._onspeechend_ =     function() { debug('onspeechend');   shouldBe('count', '5'); ++count; }

Modified: trunk/Source/WebCore/ChangeLog (136318 => 136319)


--- trunk/Source/WebCore/ChangeLog	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/ChangeLog	2012-12-02 09:45:48 UTC (rev 136319)
@@ -1,3 +1,37 @@
+2012-12-02  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r136236.
+        http://trac.webkit.org/changeset/136236
+        https://bugs.webkit.org/show_bug.cgi?id=103833
+
+        [chromium] Flakey crashes in SpeechRecognitionEvent::emma
+        during GC. (Requested by mkwst on #webkit).
+
+        * Modules/speech/SpeechRecognition.cpp:
+        (WebCore::SpeechRecognition::start):
+        * Modules/speech/SpeechRecognition.h:
+        (SpeechRecognition):
+        * Modules/speech/SpeechRecognitionEvent.cpp:
+        (WebCore::SpeechRecognitionEvent::SpeechRecognitionEvent):
+        * Modules/speech/SpeechRecognitionEvent.h:
+        (SpeechRecognitionEventInit):
+        (SpeechRecognitionEvent):
+        (WebCore::SpeechRecognitionEvent::resultIndex):
+        * Modules/speech/SpeechRecognitionEvent.idl:
+        * Modules/speech/SpeechRecognitionResult.cpp:
+        (WebCore::emmaQualifiedName):
+        (WebCore):
+        (WebCore::SpeechRecognitionResult::emma):
+        * Modules/speech/SpeechRecognitionResult.h:
+        (WebCore):
+        (WebCore::SpeechRecognitionResult::final):
+        (SpeechRecognitionResult):
+        * Modules/speech/SpeechRecognitionResult.idl:
+        * WebCore.gypi:
+        * bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp: Renamed from Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp.
+        (WebCore):
+        (WebCore::V8SpeechRecognitionResult::opaqueRootForGC):
+
 2012-12-01  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r136015.

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -54,7 +54,6 @@
     }
 
     setPendingActivity(this);
-    m_finalResults.clear();
     m_controller->start(this, m_grammars.get(), m_lang, m_continuous, m_interimResults, m_maxAlternatives);
     m_started = true;
 }
@@ -106,20 +105,6 @@
     dispatchEvent(SpeechRecognitionEvent::createResult(result, resultIndex, resultHistory));
 }
 
-void SpeechRecognition::didReceiveResults(const Vector<RefPtr<SpeechRecognitionResult> >& newFinalResults, const Vector<RefPtr<SpeechRecognitionResult> >& currentInterimResults)
-{
-    unsigned long resultIndex = m_finalResults.size();
-
-    for (size_t i = 0; i < newFinalResults.size(); ++i)
-        m_finalResults.append(newFinalResults[i]);
-
-    Vector<RefPtr<SpeechRecognitionResult> > results = m_finalResults;
-    for (size_t i = 0; i < currentInterimResults.size(); ++i)
-        results.append(currentInterimResults[i]);
-
-    dispatchEvent(SpeechRecognitionEvent::createResult(resultIndex, results));
-}
-
 void SpeechRecognition::didReceiveNoMatch(PassRefPtr<SpeechRecognitionResult> result)
 {
     dispatchEvent(SpeechRecognitionEvent::createNoMatch(result));

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognition.h (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.h	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.h	2012-12-02 09:45:48 UTC (rev 136319)
@@ -73,8 +73,6 @@
     void didEndSpeech();
     void didEndSound();
     void didEndAudio();
-    void didReceiveResults(const Vector<RefPtr<SpeechRecognitionResult> >& newFinalResults, const Vector<RefPtr<SpeechRecognitionResult> >& currentInterimResults);
-    // FIXME: Remove this once we start using didReceiveResults.
     void didReceiveResult(PassRefPtr<SpeechRecognitionResult>, unsigned long resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
     void didReceiveNoMatch(PassRefPtr<SpeechRecognitionResult>);
     void didReceiveError(PassRefPtr<SpeechRecognitionError>);
@@ -126,7 +124,6 @@
     SpeechRecognitionController* m_controller;
     bool m_stoppedByActiveDOMObject;
     bool m_started;
-    Vector<RefPtr<SpeechRecognitionResult> > m_finalResults;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -29,10 +29,6 @@
 
 #include "SpeechRecognitionEvent.h"
 
-#include "Document.h"
-#include "Element.h"
-#include "Text.h"
-
 namespace WebCore {
 
 SpeechRecognitionEventInit::SpeechRecognitionEventInit()
@@ -55,11 +51,6 @@
     return adoptRef(new SpeechRecognitionEvent(eventNames().resultEvent, result, resultIndex, resultHistory));
 }
 
-PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createResult(unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results)
-{
-    return adoptRef(new SpeechRecognitionEvent(eventNames().resultEvent, resultIndex, results));
-}
-
 PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createNoMatch(PassRefPtr<SpeechRecognitionResult> result)
 {
     return adoptRef(new SpeechRecognitionEvent(eventNames().nomatchEvent, result, 0, 0));
@@ -77,80 +68,20 @@
 
 SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, const SpeechRecognitionEventInit& initializer)
     : Event(eventName, initializer)
-    , m_resultIndex(initializer.resultIndex)
     , m_result(initializer.result)
+    , m_resultIndex(initializer.resultIndex)
     , m_resultHistory(initializer.resultHistory)
 {
 }
 
 SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult> result, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
     : Event(eventName, /*canBubble=*/false, /*cancelable=*/false)
-    , m_resultIndex(resultIndex)
     , m_result(result)
+    , m_resultIndex(resultIndex)
     , m_resultHistory(resultHistory)
 {
 }
 
-SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results)
-    : Event(eventName, /*canBubble=*/false, /*cancelable=*/false)
-    , m_resultIndex(resultIndex)
-    , m_results(SpeechRecognitionResultList::create(results))
-{
-}
-
-SpeechRecognitionEvent::~SpeechRecognitionEvent()
-{
-}
-
-static QualifiedName emmaQualifiedName(const char* localName)
-{
-    const char emmaNamespaceUrl[] = "http://www.w3.org/2003/04/emma";
-    return QualifiedName("emma", localName, emmaNamespaceUrl);
-}
-
-Document* SpeechRecognitionEvent::emma()
-{
-    if (m_emma)
-        return m_emma.get();
-
-    RefPtr<Document> document = Document::create(0, KURL());
-
-    for (size_t i = 0; i < m_results->length(); ++i) {
-        RefPtr<SpeechRecognitionResult> result = m_results->item(0);
-
-        RefPtr<Element> emmaElement = document->createElement(emmaQualifiedName("emma"), false);
-        ExceptionCode ec = 0;
-        emmaElement->setAttribute("version", "1.0", ec);
-        ASSERT(!ec);
-        if (ec)
-            return 0;
-
-        RefPtr<Element> _oneOf_ = document->createElement(emmaQualifiedName("one-of"), false);
-        oneOf->setAttribute(emmaQualifiedName("medium"), "acoustic");
-        oneOf->setAttribute(emmaQualifiedName("mode"), "voice");
-        oneOf->setIdAttribute("one-of");
-
-        for (size_t i = 0; i < result->length(); ++i) {
-            const RefPtr<SpeechRecognitionAlternative>& alternative = result->item(i);
-
-            RefPtr<Element> interpretation = document->createElement(emmaQualifiedName("interpretation"), false);
-            interpretation->setIdAttribute(String::number(i + 1));
-            interpretation->setAttribute(emmaQualifiedName("confidence"), String::number(alternative->confidence()));
-
-            RefPtr<Element> literal = document->createElement(emmaQualifiedName("literal"), false);
-            literal->appendChild(document->createTextNode(alternative->transcript()));
-            interpretation->appendChild(literal.release());
-            oneOf->appendChild(interpretation.release());
-        }
-
-        emmaElement->appendChild(oneOf.release());
-        document->appendChild(emmaElement.release());
-    }
-
-    m_emma = document;
-    return m_emma.get();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(SCRIPTED_SPEECH)

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h	2012-12-02 09:45:48 UTC (rev 136319)
@@ -36,7 +36,6 @@
 
 namespace WebCore {
 
-class Document;
 class SpeechRecognitionError;
 class SpeechRecognitionResult;
 class SpeechRecognitionResultList;
@@ -44,32 +43,21 @@
 struct SpeechRecognitionEventInit : public EventInit {
     SpeechRecognitionEventInit();
 
-    // DEPRECATED
     RefPtr<SpeechRecognitionResult> result;
-    RefPtr<SpeechRecognitionResultList> resultHistory;
-
     short resultIndex;
-    RefPtr<SpeechRecognitionResultList> results;
+    RefPtr<SpeechRecognitionResultList> resultHistory;
 };
 
 class SpeechRecognitionEvent : public Event {
 public:
     static PassRefPtr<SpeechRecognitionEvent> create();
     static PassRefPtr<SpeechRecognitionEvent> create(const AtomicString&, const SpeechRecognitionEventInit&);
-    virtual ~SpeechRecognitionEvent();
 
-    // DEPRECATED
     static PassRefPtr<SpeechRecognitionEvent> createResult(PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
-
-    static PassRefPtr<SpeechRecognitionEvent> createResult(unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results);
     static PassRefPtr<SpeechRecognitionEvent> createNoMatch(PassRefPtr<SpeechRecognitionResult>);
 
-    unsigned long resultIndex() const { return m_resultIndex; }
-    SpeechRecognitionResultList* results() const { return m_results.get(); }
-    Document* emma();
-
-    // DEPRECATED
     SpeechRecognitionResult* result() const { return m_result.get(); }
+    short resultIndex() const { return m_resultIndex; } // FIXME: Spec says this should be short, but other indices are unsigned ints.
     SpeechRecognitionResultList* resultHistory() const { return m_resultHistory.get(); }
 
     // Event
@@ -78,16 +66,11 @@
 private:
     SpeechRecognitionEvent();
     SpeechRecognitionEvent(const AtomicString&, const SpeechRecognitionEventInit&);
-    SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory); // FIXME: Remove.
-    SpeechRecognitionEvent(const AtomicString& eventName, unsigned long resultIndex, const Vector<RefPtr<SpeechRecognitionResult> >& results);
+    SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
     explicit SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError>);
 
-    unsigned long m_resultIndex;
-    RefPtr<SpeechRecognitionResultList> m_results;
-    RefPtr<Document> m_emma;
-
-    // DEPRECATED
     RefPtr<SpeechRecognitionResult> m_result;
+    short m_resultIndex;
     RefPtr<SpeechRecognitionResultList> m_resultHistory;
 };
 

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl	2012-12-02 09:45:48 UTC (rev 136319)
@@ -25,15 +25,9 @@
 
 [
     Conditional=SCRIPTED_SPEECH,
-    ConstructorTemplate=Event,
-    CustomIsReachable,
-    V8DependentLifetime
+    ConstructorTemplate=Event
 ] interface SpeechRecognitionEvent : Event {
-    // DEPRECATED
     [InitializedByEventConstructor] readonly attribute SpeechRecognitionResult result;
-    [InitializedByEventConstructor] readonly attribute SpeechRecognitionResultList resultHistory;
-
     [InitializedByEventConstructor] readonly attribute short resultIndex;
-    [InitializedByEventConstructor] readonly attribute SpeechRecognitionResultList results;
-    readonly attribute Document emma;
+    [InitializedByEventConstructor] readonly attribute SpeechRecognitionResultList resultHistory;
 };

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -29,6 +29,10 @@
 
 #include "SpeechRecognitionResult.h"
 
+#include "Document.h"
+#include "Element.h"
+#include "Text.h"
+
 namespace WebCore {
 
 SpeechRecognitionResult::~SpeechRecognitionResult()
@@ -48,6 +52,51 @@
     return m_alternatives[index].get();
 }
 
+static QualifiedName emmaQualifiedName(const char* localName)
+{
+    const char emmaNamespaceUrl[] = "http://www.w3.org/2003/04/emma";
+    return QualifiedName("emma", localName, emmaNamespaceUrl);
+}
+
+Document* SpeechRecognitionResult::emma()
+{
+    if (m_emma)
+        return m_emma.get();
+
+    RefPtr<Document> document = Document::create(0, KURL());
+
+    RefPtr<Element> emmaElement = document->createElement(emmaQualifiedName("emma"), false);
+    ExceptionCode ec = 0;
+    emmaElement->setAttribute("version", "1.0", ec);
+    ASSERT(!ec);
+    if (ec)
+        return 0;
+
+    RefPtr<Element> _oneOf_ = document->createElement(emmaQualifiedName("one-of"), false);
+    oneOf->setAttribute(emmaQualifiedName("medium"), "acoustic");
+    oneOf->setAttribute(emmaQualifiedName("mode"), "voice");
+    oneOf->setIdAttribute("one-of");
+
+    for (size_t i = 0; i < m_alternatives.size(); ++i) {
+        const RefPtr<SpeechRecognitionAlternative>& alternative = m_alternatives[i];
+
+        RefPtr<Element> interpretation = document->createElement(emmaQualifiedName("interpretation"), false);
+        interpretation->setIdAttribute(String::number(i + 1));
+        interpretation->setAttribute(emmaQualifiedName("confidence"), String::number(alternative->confidence()));
+
+        RefPtr<Element> literal = document->createElement(emmaQualifiedName("literal"), false);
+        literal->appendChild(document->createTextNode(alternative->transcript()));
+        interpretation->appendChild(literal.release());
+        oneOf->appendChild(interpretation.release());
+    }
+
+    emmaElement->appendChild(oneOf.release());
+    document->appendChild(emmaElement.release());
+
+    m_emma = document;
+    return m_emma.get();
+}
+
 SpeechRecognitionResult::SpeechRecognitionResult(const Vector<RefPtr<SpeechRecognitionAlternative> >& alternatives, bool final)
     : m_alternatives(alternatives)
     , m_final(final)

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.h (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.h	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.h	2012-12-02 09:45:48 UTC (rev 136319)
@@ -34,6 +34,8 @@
 
 namespace WebCore {
 
+class Document;
+
 class SpeechRecognitionResult : public RefCounted<SpeechRecognitionResult> {
 public:
     ~SpeechRecognitionResult();
@@ -41,13 +43,15 @@
 
     unsigned long length() { return m_alternatives.size(); }
     SpeechRecognitionAlternative* item(unsigned long index);
-    bool isFinal() { return m_final; }
+    bool final() { return m_final; }
+    Document* emma();
 
 private:
     SpeechRecognitionResult(const Vector<RefPtr<SpeechRecognitionAlternative> >&, bool final);
 
     Vector<RefPtr<SpeechRecognitionAlternative> > m_alternatives;
     bool m_final;
+    RefPtr<Document> m_emma;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl (136318 => 136319)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionResult.idl	2012-12-02 09:45:48 UTC (rev 136319)
@@ -25,9 +25,12 @@
 
 [
     Conditional=SCRIPTED_SPEECH,
-    IndexedGetter
+    CustomIsReachable,
+    IndexedGetter,
+    V8DependentLifetime
 ] interface SpeechRecognitionResult {
     readonly attribute unsigned long length;
     SpeechRecognitionAlternative item(in [IsIndex] unsigned long index);
-    readonly attribute boolean isFinal;
+    readonly attribute boolean final;
+    readonly attribute Document emma;
 };

Modified: trunk/Source/WebCore/WebCore.gypi (136318 => 136319)


--- trunk/Source/WebCore/WebCore.gypi	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/WebCore.gypi	2012-12-02 09:45:48 UTC (rev 136319)
@@ -2430,7 +2430,7 @@
             'bindings/v8/custom/V8SVGPathSegCustom.cpp',
             'bindings/v8/custom/V8ScriptProfileCustom.cpp',
             'bindings/v8/custom/V8ScriptProfileNodeCustom.cpp',
-            'bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp',
+            'bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp',
             'bindings/v8/custom/V8StorageCustom.cpp',
             'bindings/v8/custom/V8StyleSheetCustom.cpp',
             'bindings/v8/custom/V8StyleSheetListCustom.cpp',

Deleted: trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp (136318 => 136319)


--- trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2012 Google 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:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 ``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 THE COPYRIGHT OWNER 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 "config.h"
-
-#if ENABLE(SCRIPTED_SPEECH)
-
-#include "V8SpeechRecognitionEvent.h"
-
-#include "SpeechRecognitionEvent.h"
-#include "V8Binding.h"
-#include "V8GCController.h"
-
-namespace WebCore {
-
-void* V8SpeechRecognitionEvent::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
-{
-    ASSERT(V8SpeechRecognitionEvent::HasInstance(wrapper));
-    SpeechRecognitionEvent* impl = static_cast<SpeechRecognitionEvent*>(object);
-    return V8GCController::opaqueRootForGC(impl->emma());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SCRIPTED_SPEECH)

Copied: trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp (from rev 136318, trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionEventCustom.cpp) (0 => 136319)


--- trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Google 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:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * 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 ``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 THE COPYRIGHT OWNER 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 "config.h"
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "V8SpeechRecognitionResult.h"
+
+#include "SpeechRecognitionResult.h"
+#include "V8Binding.h"
+#include "V8GCController.h"
+
+namespace WebCore {
+
+void* V8SpeechRecognitionResult::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
+{
+    ASSERT(V8SpeechRecognitionResult::HasInstance(wrapper));
+    SpeechRecognitionResult* impl = static_cast<SpeechRecognitionResult*>(object);
+    return V8GCController::opaqueRootForGC(impl->emma());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)

Property changes: trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp


Added: svn:eol-style

Modified: trunk/Source/WebKit/chromium/ChangeLog (136318 => 136319)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-12-02 09:45:48 UTC (rev 136319)
@@ -1,3 +1,17 @@
+2012-12-02  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r136236.
+        http://trac.webkit.org/changeset/136236
+        https://bugs.webkit.org/show_bug.cgi?id=103833
+
+        [chromium] Flakey crashes in SpeechRecognitionEvent::emma
+        during GC. (Requested by mkwst on #webkit).
+
+        * public/WebSpeechRecognizerClient.h:
+        * src/SpeechRecognitionClientProxy.cpp:
+        * src/SpeechRecognitionClientProxy.h:
+        (SpeechRecognitionClientProxy):
+
 2012-11-30  Mike West  <[email protected]>
 
         CSP 1.1: Make the CSP_NEXT flag runtime enabled.

Modified: trunk/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h (136318 => 136319)


--- trunk/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h	2012-12-02 09:45:48 UTC (rev 136319)
@@ -68,17 +68,8 @@
     virtual void didEndAudio(const WebSpeechRecognitionHandle&) = 0;
 
     // To be called when the speech recognizer returns a result.
-    // FIXME: Remove this when we have moved over to only use the function below.
     virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) = 0;
 
-    // To be called when the speech recognizer provides new results.
-    // - newFinalResults contains zero or more final results that are new since
-    // the last time the functions was called.
-    // - currentInterimResults contains zero or more inteirm results that
-    // replace the interim results that were reported the last time this
-    // function was called.
-    virtual void didReceiveResults(const WebSpeechRecognitionHandle&, const WebVector<WebSpeechRecognitionResult>& newFinalResults, const WebVector<WebSpeechRecognitionResult>& currentInterimResults) = 0;
-
     // To be called when the speech recognizer returns a final result with no
     // recognizion hypothesis.
     virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) = 0;

Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp (136318 => 136319)


--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -113,21 +113,6 @@
 
 }
 
-void SpeechRecognitionClientProxy::didReceiveResults(const WebSpeechRecognitionHandle& handle, const WebVector<WebSpeechRecognitionResult>& newFinalResults, const WebVector<WebSpeechRecognitionResult>& currentInterimResults)
-{
-    RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
-
-    Vector<RefPtr<SpeechRecognitionResult> > finalResultsVector(newFinalResults.size());
-    for (size_t i = 0; i < newFinalResults.size(); ++i)
-        finalResultsVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(newFinalResults[i]);
-
-    Vector<RefPtr<SpeechRecognitionResult> > interimResultsVector(currentInterimResults.size());
-    for (size_t i = 0; i < currentInterimResults.size(); ++i)
-        interimResultsVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(currentInterimResults[i]);
-
-    recognition->didReceiveResults(finalResultsVector, interimResultsVector);
-}
-
 void SpeechRecognitionClientProxy::didReceiveNoMatch(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionResult& result)
 {
     RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);

Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h (136318 => 136319)


--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h	2012-12-02 09:45:48 UTC (rev 136319)
@@ -56,7 +56,6 @@
     virtual void didEndSound(const WebSpeechRecognitionHandle&) OVERRIDE;
     virtual void didEndAudio(const WebSpeechRecognitionHandle&) OVERRIDE;
     virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE;
-    virtual void didReceiveResults(const WebSpeechRecognitionHandle&, const WebVector<WebSpeechRecognitionResult>& newFinalResults, const WebVector<WebSpeechRecognitionResult>& currentInterimResults) OVERRIDE;
     virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) OVERRIDE;
     virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, WebSpeechRecognizerClient::ErrorCode) OVERRIDE;
     virtual void didStart(const WebSpeechRecognitionHandle&) OVERRIDE;

Modified: trunk/Tools/ChangeLog (136318 => 136319)


--- trunk/Tools/ChangeLog	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Tools/ChangeLog	2012-12-02 09:45:48 UTC (rev 136319)
@@ -1,3 +1,14 @@
+2012-12-02  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r136236.
+        http://trac.webkit.org/changeset/136236
+        https://bugs.webkit.org/show_bug.cgi?id=103833
+
+        [chromium] Flakey crashes in SpeechRecognitionEvent::emma
+        during GC. (Requested by mkwst on #webkit).
+
+        * DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp:
+
 2012-12-01  Zan Dobersek  <[email protected]>
 
         [XvfbDriver] XvfbDriverTest.test_next_free_display is flaky on builders using XvfbDriver

Modified: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp (136318 => 136319)


--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp	2012-12-02 08:00:14 UTC (rev 136318)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp	2012-12-02 09:45:48 UTC (rev 136319)
@@ -69,11 +69,10 @@
         WebVector<float> confidences(static_cast<size_t>(1));
         transcripts[0] = m_transcript;
         confidences[0] = m_confidence;
-        WebVector<WebSpeechRecognitionResult> finalResults(static_cast<size_t>(1));
-        WebVector<WebSpeechRecognitionResult> interimResults;
-        finalResults[0].assign(transcripts, confidences, true);
+        WebSpeechRecognitionResult res;
+        res.assign(transcripts, confidences, true);
 
-        m_recognizer->client()->didReceiveResults(m_recognizer->handle(), finalResults, interimResults);
+        m_recognizer->client()->didReceiveResult(m_recognizer->handle(), res, 0, WebVector<WebSpeechRecognitionResult>());
     }
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to