Title: [122927] trunk/Source/WebKit/chromium
Revision
122927
Author
[email protected]
Date
2012-07-18 01:08:50 -0700 (Wed, 18 Jul 2012)

Log Message

Add copy constructor to WebSpeechGrammar.h
https://bugs.webkit.org/show_bug.cgi?id=91484

Reviewed by Adam Barth.

Provide user-defined copy constructor (and assign function) for WebSpeechGrammar.
Without this, we were hitting the implicit copy constructor, which in
turn used the implicit copy constructor of WebPrivatePtr. This was bad,
because the implicit copy constructor wouldn't increace the reference
count on the wrapped object, causing us to crash.

Also add one for WebSpeechRecognitionResult; haven't seen any problems
here, but I noticed it was missing.

* public/WebSpeechGrammar.h:
(WebKit::WebSpeechGrammar::WebSpeechGrammar):
(WebSpeechGrammar):
* public/WebSpeechRecognitionResult.h:
(WebKit::WebSpeechRecognitionResult::WebSpeechRecognitionResult):
(WebSpeechRecognitionResult):
* src/WebSpeechGrammar.cpp:
(WebKit::WebSpeechGrammar::assign):
(WebKit):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (122926 => 122927)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-18 08:02:19 UTC (rev 122926)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-18 08:08:50 UTC (rev 122927)
@@ -1,3 +1,29 @@
+2012-07-18  Hans Wennborg  <[email protected]>
+
+        Add copy constructor to WebSpeechGrammar.h
+        https://bugs.webkit.org/show_bug.cgi?id=91484
+
+        Reviewed by Adam Barth.
+
+        Provide user-defined copy constructor (and assign function) for WebSpeechGrammar.
+        Without this, we were hitting the implicit copy constructor, which in
+        turn used the implicit copy constructor of WebPrivatePtr. This was bad,
+        because the implicit copy constructor wouldn't increace the reference
+        count on the wrapped object, causing us to crash.
+
+        Also add one for WebSpeechRecognitionResult; haven't seen any problems
+        here, but I noticed it was missing.
+
+        * public/WebSpeechGrammar.h:
+        (WebKit::WebSpeechGrammar::WebSpeechGrammar):
+        (WebSpeechGrammar):
+        * public/WebSpeechRecognitionResult.h:
+        (WebKit::WebSpeechRecognitionResult::WebSpeechRecognitionResult):
+        (WebSpeechRecognitionResult):
+        * src/WebSpeechGrammar.cpp:
+        (WebKit::WebSpeechGrammar::assign):
+        (WebKit):
+
 2012-07-17  Yoshifumi Inoue  <[email protected]>
 
         Decimal constructor with 99999999999999999 loses last digit

Modified: trunk/Source/WebKit/chromium/public/WebSpeechGrammar.h (122926 => 122927)


--- trunk/Source/WebKit/chromium/public/WebSpeechGrammar.h	2012-07-18 08:02:19 UTC (rev 122926)
+++ trunk/Source/WebKit/chromium/public/WebSpeechGrammar.h	2012-07-18 08:08:50 UTC (rev 122927)
@@ -39,12 +39,14 @@
 class WebSpeechGrammar {
 public:
     WebSpeechGrammar() { }
+    WebSpeechGrammar(const WebSpeechGrammar& grammar) { assign(grammar); }
     ~WebSpeechGrammar() { reset(); }
 
     WEBKIT_EXPORT WebURL src() const;
     WEBKIT_EXPORT float weight() const;
 
     WEBKIT_EXPORT void reset();
+    WEBKIT_EXPORT void assign(const WebSpeechGrammar&);
 
 #if WEBKIT_IMPLEMENTATION
     WebSpeechGrammar(const WTF::PassRefPtr<WebCore::SpeechGrammar>&);

Modified: trunk/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h (122926 => 122927)


--- trunk/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h	2012-07-18 08:02:19 UTC (rev 122926)
+++ trunk/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h	2012-07-18 08:08:50 UTC (rev 122927)
@@ -40,6 +40,7 @@
 class WebSpeechRecognitionResult {
 public:
     WebSpeechRecognitionResult() { }
+    WebSpeechRecognitionResult(const WebSpeechRecognitionResult& result) { assign(result); }
     ~WebSpeechRecognitionResult() { reset(); }
 
     WEBKIT_EXPORT void assign(const WebVector<WebString>& transcripts, const WebVector<float>& confidences, bool final);

Modified: trunk/Source/WebKit/chromium/src/WebSpeechGrammar.cpp (122926 => 122927)


--- trunk/Source/WebKit/chromium/src/WebSpeechGrammar.cpp	2012-07-18 08:02:19 UTC (rev 122926)
+++ trunk/Source/WebKit/chromium/src/WebSpeechGrammar.cpp	2012-07-18 08:08:50 UTC (rev 122927)
@@ -36,6 +36,11 @@
     m_private.reset();
 }
 
+void WebSpeechGrammar::assign(const WebSpeechGrammar& other)
+{
+    m_private = other.m_private;
+}
+
 WebSpeechGrammar::WebSpeechGrammar(const PassRefPtr<WebCore::SpeechGrammar>& value)
     : m_private(value)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to