Title: [111022] trunk/Source/WebCore
Revision
111022
Author
[email protected]
Date
2012-03-16 10:07:41 -0700 (Fri, 16 Mar 2012)

Log Message

Allow AudioContext::create() to emit an ExceptionCode.
https://bugs.webkit.org/show_bug.cgi?id=81049

Reviewed by Kentaro Hara.

No new tests; no change in functionality.

Pass through an ExceptionCode parameter to AudioContext::create().  It is currently
never modified, but exceptions will be added in the future.

* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContextConstructor::constructJSAudioContext):
* bindings/v8/custom/V8AudioContextCustom.cpp:
(WebCore::V8AudioContext::constructorCallback):
* webaudio/AudioContext.cpp:
(WebCore::AudioContext::create):
* webaudio/AudioContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111021 => 111022)


--- trunk/Source/WebCore/ChangeLog	2012-03-16 16:59:43 UTC (rev 111021)
+++ trunk/Source/WebCore/ChangeLog	2012-03-16 17:07:41 UTC (rev 111022)
@@ -1,3 +1,23 @@
+2012-03-16  Jer Noble  <[email protected]>
+
+        Allow AudioContext::create() to emit an ExceptionCode.
+        https://bugs.webkit.org/show_bug.cgi?id=81049
+
+        Reviewed by Kentaro Hara.
+
+        No new tests; no change in functionality.
+
+        Pass through an ExceptionCode parameter to AudioContext::create().  It is currently
+        never modified, but exceptions will be added in the future.
+
+        * bindings/js/JSAudioContextCustom.cpp:
+        (WebCore::JSAudioContextConstructor::constructJSAudioContext):
+        * bindings/v8/custom/V8AudioContextCustom.cpp:
+        (WebCore::V8AudioContext::constructorCallback):
+        * webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::create):
+        * webaudio/AudioContext.h:
+
 2012-03-16  Dana Jansens  <[email protected]>
 
         [chromium] Remove surface damage client from occlusion tracker

Modified: trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp (111021 => 111022)


--- trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp	2012-03-16 16:59:43 UTC (rev 111021)
+++ trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp	2012-03-16 17:07:41 UTC (rev 111022)
@@ -68,7 +68,12 @@
     
     if (!exec->argumentCount()) {
         // Constructor for default AudioContext which talks to audio hardware.
-        audioContext = AudioContext::create(document);
+        ExceptionCode ec = 0;
+        audioContext = AudioContext::create(document, ec);
+        if (ec) {
+            setDOMException(exec, ec);
+            return JSValue::encode(JSValue());
+        }
         if (!audioContext.get())
             return throwVMError(exec, createSyntaxError(exec, "audio resources unavailable for AudioContext construction"));
     } else {

Modified: trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp (111021 => 111022)


--- trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp	2012-03-16 16:59:43 UTC (rev 111021)
+++ trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp	2012-03-16 17:07:41 UTC (rev 111022)
@@ -61,7 +61,10 @@
     
     if (!args.Length()) {
         // Constructor for default AudioContext which talks to audio hardware.
-        audioContext = AudioContext::create(document);
+        ExceptionCode ec = 0;
+        audioContext = AudioContext::create(document, ec);
+        if (ec)
+            return throwError(ec);
         if (!audioContext.get())
             return throwError("audio resources unavailable for AudioContext construction", V8Proxy::SyntaxError);
     } else {

Modified: trunk/Source/WebCore/webaudio/AudioContext.cpp (111021 => 111022)


--- trunk/Source/WebCore/webaudio/AudioContext.cpp	2012-03-16 16:59:43 UTC (rev 111021)
+++ trunk/Source/WebCore/webaudio/AudioContext.cpp	2012-03-16 17:07:41 UTC (rev 111022)
@@ -96,8 +96,10 @@
 const unsigned MaxHardwareContexts = 4;
 unsigned AudioContext::s_hardwareContextCount = 0;
     
-PassRefPtr<AudioContext> AudioContext::create(Document* document)
+PassRefPtr<AudioContext> AudioContext::create(Document* document, ExceptionCode& ec)
 {
+    UNUSED_PARAM(ec);
+
     ASSERT(document);
     ASSERT(isMainThread());
     if (s_hardwareContextCount >= MaxHardwareContexts)

Modified: trunk/Source/WebCore/webaudio/AudioContext.h (111021 => 111022)


--- trunk/Source/WebCore/webaudio/AudioContext.h	2012-03-16 16:59:43 UTC (rev 111021)
+++ trunk/Source/WebCore/webaudio/AudioContext.h	2012-03-16 17:07:41 UTC (rev 111022)
@@ -72,7 +72,7 @@
 class AudioContext : public ActiveDOMObject, public ThreadSafeRefCounted<AudioContext>, public EventTarget {
 public:
     // Create an AudioContext for rendering to the audio hardware.
-    static PassRefPtr<AudioContext> create(Document*);
+    static PassRefPtr<AudioContext> create(Document*, ExceptionCode&);
 
     // Create an AudioContext for offline (non-realtime) rendering.
     static PassRefPtr<AudioContext> createOfflineContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to