Title: [102339] trunk/Source/WebCore
Revision
102339
Author
[email protected]
Date
2011-12-08 07:45:39 -0800 (Thu, 08 Dec 2011)

Log Message

Provide more specific error description for SocketStreamError.
https://bugs.webkit.org/show_bug.cgi?id=74066

Patch by Takashi Toyoshima <[email protected]> on 2011-12-08
Reviewed by Martin Robinson.

No new tests because this change just improve error messages for unexpected failures.

* platform/network/soup/SocketStreamError.h: Add an argument for passing error description.
(WebCore::SocketStreamError::SocketStreamError):
* platform/network/soup/SocketStreamHandleSoup.cpp: Add error description for SocketStreamError.
(WebCore::SocketStreamHandle::connected):
(WebCore::SocketStreamHandle::readBytes):
(WebCore::SocketStreamHandle::platformSend):
(WebCore::SocketStreamHandle::platformClose):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102338 => 102339)


--- trunk/Source/WebCore/ChangeLog	2011-12-08 15:32:37 UTC (rev 102338)
+++ trunk/Source/WebCore/ChangeLog	2011-12-08 15:45:39 UTC (rev 102339)
@@ -1,3 +1,20 @@
+2011-12-08  Takashi Toyoshima  <[email protected]>
+
+        Provide more specific error description for SocketStreamError.
+        https://bugs.webkit.org/show_bug.cgi?id=74066
+
+        Reviewed by Martin Robinson.
+
+        No new tests because this change just improve error messages for unexpected failures.
+
+        * platform/network/soup/SocketStreamError.h: Add an argument for passing error description.
+        (WebCore::SocketStreamError::SocketStreamError):
+        * platform/network/soup/SocketStreamHandleSoup.cpp: Add error description for SocketStreamError.
+        (WebCore::SocketStreamHandle::connected):
+        (WebCore::SocketStreamHandle::readBytes):
+        (WebCore::SocketStreamHandle::platformSend):
+        (WebCore::SocketStreamHandle::platformClose):
+
 2011-12-08  Mihnea Ovidenie  <[email protected]>
 
         [CSSRegions][CSSOM] Implement NamedFlow interface

Modified: trunk/Source/WebCore/platform/network/soup/SocketStreamError.h (102338 => 102339)


--- trunk/Source/WebCore/platform/network/soup/SocketStreamError.h	2011-12-08 15:32:37 UTC (rev 102338)
+++ trunk/Source/WebCore/platform/network/soup/SocketStreamError.h	2011-12-08 15:45:39 UTC (rev 102339)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Google Inc.  All rights reserved.
+ * Copyright (C) 2009, 2011 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
@@ -38,8 +38,8 @@
     class SocketStreamError : public SocketStreamErrorBase {
     public:
         SocketStreamError() { }
-        explicit SocketStreamError(int errorCode)
-            : SocketStreamErrorBase(errorCode)
+        explicit SocketStreamError(int errorCode, const gchar* description)
+            : SocketStreamErrorBase(errorCode, String(), String(description))
         {
         }
 

Modified: trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp (102338 => 102339)


--- trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp	2011-12-08 15:32:37 UTC (rev 102338)
+++ trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp	2011-12-08 15:45:39 UTC (rev 102339)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Google Inc.  All rights reserved.
+ * Copyright (C) 2009, 2011 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
@@ -102,7 +102,7 @@
 void SocketStreamHandle::connected(GSocketConnection* socketConnection, GError* error)
 {
     if (error) {
-        m_client->didFailSocketStream(this, SocketStreamError(error->code));
+        m_client->didFailSocketStream(this, SocketStreamError(error->code, error->message));
         return;
     }
 
@@ -125,7 +125,7 @@
 void SocketStreamHandle::readBytes(signed long bytesRead, GError* error)
 {
     if (error) {
-        m_client->didFailSocketStream(this, SocketStreamError(error->code));
+        m_client->didFailSocketStream(this, SocketStreamError(error->code, error->message));
         return;
     }
 
@@ -155,15 +155,13 @@
 
 int SocketStreamHandle::platformSend(const char* data, int length)
 {
-    if (!g_pollable_output_stream_is_writable(m_outputStream.get())) {
-        beginWaitingForSocketWritability();
-        return 0;
-    }
-
     GOwnPtr<GError> error;
     gssize written = g_pollable_output_stream_write_nonblocking(m_outputStream.get(), data, length, 0, &error.outPtr());
-    if (error && !g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
-        m_client->didFailSocketStream(this, SocketStreamError(error->code)); // FIXME: Provide a sensible error.
+    if (error) {
+        if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+            beginWaitingForSocketWritability();
+        else
+            m_client->didFailSocketStream(this, SocketStreamError(error->code, error->message));
         return 0;
     }
 
@@ -185,7 +183,7 @@
         GOwnPtr<GError> error;
         g_io_stream_close(G_IO_STREAM(m_socketConnection.get()), 0, &error.outPtr());
         if (error)
-            m_client->didFailSocketStream(this, SocketStreamError(error->code)); // FIXME: Provide a sensible error.
+            m_client->didFailSocketStream(this, SocketStreamError(error->code, error->message));
         m_socketConnection = 0;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to