Changeset 152446 in webkit
- Timestamp:
- Jul 8, 2013 3:13:06 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/platform/gtk/SharedBufferGtk.cpp
r95901 r152446 21 21 22 22 #include "FileSystem.h" 23 #include <wtf/gobject/GOwnPtr.h> 23 24 #include <wtf/text/CString.h> 24 25 … … 34 35 35 36 CString filename = fileSystemRepresentation(filePath); 36 gchar*contents;37 GOwnPtr<gchar> contents; 37 38 gsize size; 38 G Error* error = 0;39 if (!g_file_get_contents(filename.data(), &contents , &size, &error)) {39 GOwnPtr<GError> error; 40 if (!g_file_get_contents(filename.data(), &contents.outPtr(), &size, &error.outPtr())) { 40 41 LOG_ERROR("Failed to fully read contents of file %s - %s", filenameForDisplay(filePath).utf8().data(), error->message); 41 g_error_free(error);42 42 return 0; 43 43 } 44 44 45 RefPtr<SharedBuffer> result = SharedBuffer::create(contents, size); 46 g_free(contents); 45 RefPtr<SharedBuffer> result = SharedBuffer::create(contents.get(), size); 47 46 48 47 return result.release(); -
trunk/Source/WebKit/gtk/ChangeLog
r152396 r152446 1 2013-07-08 Brian Holt <brian.holt@samsung.com> 2 3 [GTK] FrameLoaderClient: Refactor naked pointers to use smart pointers 4 https://bugs.webkit.org/show_bug.cgi?id=118417 5 6 Reviewed by Carlos Garcia Campos. 7 8 Use GOwnPtr and GRefPtr where possible. 9 10 * WebCoreSupport/FrameLoaderClientGtk.cpp: 11 (WebKit::FrameLoaderClient::dispatchDidFailLoad): 12 1 13 2013-07-04 Mario Sanchez Prada <mario.prada@samsung.com> 2 14 -
trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
r149952 r152446 1066 1066 1067 1067 WebKitWebView* webView = getViewFromFrame(m_frame); 1068 GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), 1069 error.errorCode(), 1070 error.localizedDescription().utf8().data()); 1068 GOwnPtr<GError> webError(g_error_new_literal( 1069 g_quark_from_string(error.domain().utf8().data()), 1070 error.errorCode(), 1071 error.localizedDescription().utf8().data())); 1071 1072 gboolean isHandled = false; 1072 g_signal_emit_by_name(webView, "load-error", m_frame, error.failingURL().utf8().data(), webError, &isHandled); 1073 1074 if (isHandled) { 1075 g_error_free(webError); 1076 return; 1077 } 1078 1079 if (!shouldFallBack(error)) { 1080 g_error_free(webError); 1081 return; 1082 } 1073 g_signal_emit_by_name(webView, "load-error", m_frame, error.failingURL().utf8().data(), webError.get(), &isHandled); 1074 1075 if (isHandled || !shouldFallBack(error)) 1076 return; 1083 1077 1084 1078 m_loadingErrorPage = true; 1085 1079 1086 1080 String content; 1087 gchar* fileContent = 0;1088 1081 GOwnPtr<gchar> errorPath(g_build_filename(sharedResourcesPath().data(), "resources", "error.html", NULL)); 1089 gchar* errorURI = g_filename_to_uri(errorPath.get(), 0, 0); 1090 1091 GFile* errorFile = g_file_new_for_uri(errorURI); 1092 g_free(errorURI); 1082 GRefPtr<GFile> errorFile = adoptGRef(g_file_new_for_path(errorPath.get())); 1093 1083 1094 1084 if (!errorFile) 1095 1085 content = makeString("<html><body>", webError->message, "</body></html>"); 1096 1086 else { 1097 gboolean loaded = g_file_load_contents(errorFile, 0, &fileContent, 0, 0, 0);1098 if (! loaded)1087 GOwnPtr<gchar> fileContent; 1088 if (!g_file_load_contents(errorFile.get(), 0, &fileContent.outPtr(), 0, 0, 0)) 1099 1089 content = makeString("<html><body>", webError->message, "</body></html>"); 1100 1090 else 1101 content = String::format(fileContent , error.failingURL().utf8().data(), webError->message);1091 content = String::format(fileContent.get(), error.failingURL().utf8().data(), webError->message); 1102 1092 } 1103 1093 1104 1094 webkit_web_frame_load_alternate_string(m_frame, content.utf8().data(), 0, error.failingURL().utf8().data()); 1105 1106 g_free(fileContent);1107 1108 if (errorFile)1109 g_object_unref(errorFile);1110 1111 g_error_free(webError);1112 1095 } 1113 1096
Note: See TracChangeset
for help on using the changeset viewer.