Changeset 96680 in webkit


Ignore:
Timestamp:
Oct 5, 2011 1:03:01 AM (13 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Use WKRetainPtr for WK types in WebKit2 GTK+
https://bugs.webkit.org/show_bug.cgi?id=69404

Reviewed by Martin Robinson.

  • UIProcess/API/gtk/WebKitWebContext.cpp:

(webkitWebContextFinalize):
(createDefaultWebContext):
(webkitWebContextGetWKContext):

  • UIProcess/API/gtk/WebKitWebView.cpp:

(webkit_web_view_load_uri):
(webkit_web_view_load_alternate_html):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r96678 r96680  
     12011-10-05  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Use WKRetainPtr for WK types in WebKit2 GTK+
     4        https://bugs.webkit.org/show_bug.cgi?id=69404
     5
     6        Reviewed by Martin Robinson.
     7
     8        * UIProcess/API/gtk/WebKitWebContext.cpp:
     9        (webkitWebContextFinalize):
     10        (createDefaultWebContext):
     11        (webkitWebContextGetWKContext):
     12        * UIProcess/API/gtk/WebKitWebView.cpp:
     13        (webkit_web_view_load_uri):
     14        (webkit_web_view_load_alternate_html):
     15
    1162011-10-04  Kent Tamura  <tkent@chromium.org>
    217
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

    r96317 r96680  
    2323#include "WebKitWebContextPrivate.h"
    2424#include <WebKit2/WKContext.h>
     25#include <WebKit2/WKRetainPtr.h>
    2526#include <WebKit2/WKType.h>
    2627
    2728struct _WebKitWebContextPrivate {
    28     WKContextRef context;
     29    WKRetainPtr<WKContextRef> context;
    2930};
    3031
     
    3334static void webkitWebContextFinalize(GObject* object)
    3435{
    35     WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object);
    36 
    37     WKRelease(context->priv->context);
    38     context->priv->context = 0;
    39 
    40     context->priv->~WebKitWebContextPrivate();
    41 
     36    WEBKIT_WEB_CONTEXT(object)->priv->~WebKitWebContextPrivate();
    4237    G_OBJECT_CLASS(webkit_web_context_parent_class)->finalize(object);
    4338}
     
    6358    WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, NULL));
    6459    webContext->priv->context = WKContextGetSharedProcessContext();
    65     WKContextSetCacheModel(webContext->priv->context, kWKCacheModelPrimaryWebBrowser);
     60    WKContextSetCacheModel(webContext->priv->context.get(), kWKCacheModelPrimaryWebBrowser);
    6661    return webContext;
    6762}
     
    8479    g_assert(WEBKIT_IS_WEB_CONTEXT(context));
    8580
    86     return context->priv->context;
     81    return context->priv->context.get();
    8782}
    8883
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp

    r96614 r96680  
    2727#include "WebPageProxy.h"
    2828#include <WebKit2/WKBase.h>
     29#include <WebKit2/WKRetainPtr.h>
    2930#include <WebKit2/WKURL.h>
    3031#include <wtf/gobject/GRefPtr.h>
     
    217218    g_return_if_fail(uri);
    218219
    219     WKURLRef url = WKURLCreateWithUTF8CString(uri);
    220     WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
    221     WKPageLoadURL(toAPI(page), url);
    222     WKRelease(url);
     220    WKRetainPtr<WKURLRef> url(AdoptWK, WKURLCreateWithUTF8CString(uri));
     221    WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
     222    WKPageLoadURL(toAPI(page), url.get());
    223223}
    224224
     
    244244    g_return_if_fail(content);
    245245
    246     WKStringRef htmlString = WKStringCreateWithUTF8CString(content);
    247     WKURLRef baseURL = baseURI ? WKURLCreateWithUTF8CString(baseURI) : 0;
    248     WKURLRef unreachableURL = unreachableURI ? WKURLCreateWithUTF8CString(unreachableURI) : 0;
    249     WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
    250     WKPageLoadAlternateHTMLString(toAPI(page), htmlString, baseURL, unreachableURL);
    251     WKRelease(htmlString);
    252     if (baseURL)
    253         WKRelease(baseURL);
    254     if (unreachableURL)
    255         WKRelease(unreachableURL);
     246    WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(content));
     247    WKRetainPtr<WKURLRef> baseURL = baseURI ? adoptWK(WKURLCreateWithUTF8CString(baseURI)) : 0;
     248    WKRetainPtr<WKURLRef> unreachableURL = unreachableURI ? adoptWK(WKURLCreateWithUTF8CString(unreachableURI)) : 0;
     249    WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
     250    WKPageLoadAlternateHTMLString(toAPI(page), htmlString.get(), baseURL.get(), unreachableURL.get());
    256251}
    257252
Note: See TracChangeset for help on using the changeset viewer.