Index: Source/modules/serviceworkers/ServiceWorkerError.h |
diff --git a/Source/modules/serviceworkers/ServiceWorker.h b/Source/modules/serviceworkers/ServiceWorkerError.h |
similarity index 67% |
copy from Source/modules/serviceworkers/ServiceWorker.h |
copy to Source/modules/serviceworkers/ServiceWorkerError.h |
index 068b75757f6e741159fed3e390068c21e527c100..b0dfd5c8cfaf3c24563213fc743df93e2687650d 100644 |
--- a/Source/modules/serviceworkers/ServiceWorker.h |
+++ b/Source/modules/serviceworkers/ServiceWorkerError.h |
@@ -28,43 +28,36 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef ServiceWorker_h |
-#define ServiceWorker_h |
+#ifndef ServiceWorkerError_h |
+#define ServiceWorkerError_h |
-#include "public/platform/WebServiceWorker.h" |
-#include "wtf/OwnPtr.h" |
-#include "wtf/PassOwnPtr.h" |
-#include "wtf/PassRefPtr.h" |
-#include "wtf/RefCounted.h" |
- |
-namespace WebKit { |
-class WebServiceWorker; |
-} |
+#include "core/dom/DOMError.h" |
+#include "public/platform/WebServiceWorkerError.h" |
namespace WebCore { |
-class ServiceWorker : public RefCounted<ServiceWorker> { |
+class ServiceWorkerError : public DOMError { |
public: |
- static PassRefPtr<ServiceWorker> create(PassOwnPtr<WebKit::WebServiceWorker> worker) |
+ static PassRefPtr<ServiceWorkerError> create(WebKit::WebServiceWorkerError::ErrorType type, const String& message) |
{ |
- return adoptRef(new ServiceWorker(worker)); |
+ return adoptRef(new ServiceWorkerError(type, message)); |
} |
// For CallbackPromiseAdapter |
- typedef WebKit::WebServiceWorker WebType; |
- static PassRefPtr<ServiceWorker> from(WebType* worker) |
+ typedef WebKit::WebServiceWorkerError WebType; |
+ static PassRefPtr<DOMError> from(WebType* webError) |
{ |
- return create(adoptPtr(worker)); |
+ return create(webError->errorType(), webError->message()); |
kinuko
2013/10/15 23:44:44
If this class takes ownership of webError we shoul
|
} |
- ~ServiceWorker() { } |
+ static const String& GetErrorString(WebKit::WebServiceWorkerError::ErrorType); |
-private: |
- explicit ServiceWorker(PassOwnPtr<WebKit::WebServiceWorker>); |
+ ~ServiceWorkerError() { } |
- OwnPtr<WebKit::WebServiceWorker> m_outerWorker; |
+private: |
+ ServiceWorkerError(WebKit::WebServiceWorkerError::ErrorType type, const String& message) : DOMError(GetErrorString(type), message) { } |
}; |
} // namespace WebCore |
-#endif // ServiceWorker_h |
+#endif // ServiceWorkerError_h |