| Differences between
and this patch
- a/Source/WebKit2/ChangeLog +26 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2013-03-14  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
2
3
        [WK2][EFL] There should be only one EwkPageGroup instance per WKPageGroupRef
4
        https://bugs.webkit.org/show_bug.cgi?id=112364
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Added EwkPageGroup::findOrCreateWrapper() method which is consistent
9
        with EwkContext class.
10
        As a result there can be only one EwkPageGroup instance per WKPageGroup
11
        instance (which is right as EwkPageGroup is just a wrapper around
12
        WKPageGroup).
13
14
        * UIProcess/API/C/efl/WKView.cpp:
15
        (createWKView):
16
        * UIProcess/API/efl/ewk_page_group.cpp:
17
        (pageGroupMap):
18
        (EwkPageGroup::findOrCreateWrapper):
19
        (EwkPageGroup::create):
20
        (EwkPageGroup::EwkPageGroup):
21
        (EwkPageGroup::~EwkPageGroup):
22
        * UIProcess/API/efl/ewk_page_group_private.h:
23
        (EwkPageGroup):
24
        * UIProcess/efl/WebInspectorProxyEfl.cpp:
25
        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
26
1
2013-03-14  Abhishek Arya  <inferno@chromium.org>
27
2013-03-14  Abhishek Arya  <inferno@chromium.org>
2
28
3
        Replace static_casts with to* helper functions.
29
        Replace static_casts with to* helper functions.
- a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp -1 / +2 lines
Lines 32-38 using namespace WebKit; a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp_sec1
32
static inline WKViewRef createWKView(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef, EwkView::ViewBehavior behavior)
32
static inline WKViewRef createWKView(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef, EwkView::ViewBehavior behavior)
33
{
33
{
34
    RefPtr<EwkContext> context = contextRef ? EwkContext::findOrCreateWrapper(contextRef) : EwkContext::defaultContext();
34
    RefPtr<EwkContext> context = contextRef ? EwkContext::findOrCreateWrapper(contextRef) : EwkContext::defaultContext();
35
    RefPtr<EwkPageGroup> pageGroup = EwkPageGroup::create(pageGroupRef);
35
    RefPtr<EwkPageGroup> pageGroup = pageGroupRef ? EwkPageGroup::findOrCreateWrapper(pageGroupRef) : EwkPageGroup::create();
36
36
    Evas_Object* evasObject = EwkView::createEvasObject(canvas, context, pageGroup, behavior);
37
    Evas_Object* evasObject = EwkView::createEvasObject(canvas, context, pageGroup, behavior);
37
    if (!evasObject)
38
    if (!evasObject)
38
        return 0;
39
        return 0;
- a/Source/WebKit2/UIProcess/API/efl/ewk_page_group.cpp -2 / +29 lines
Lines 37-55 using namespace WebKit; a/Source/WebKit2/UIProcess/API/efl/ewk_page_group.cpp_sec1
37
37
38
const char EwkPageGroup::defaultIdentifier[] = "defaultPageGroupIdentifier";
38
const char EwkPageGroup::defaultIdentifier[] = "defaultPageGroupIdentifier";
39
39
40
typedef HashMap<WKPageGroupRef, EwkPageGroup*> PageGroupMap;
41
42
static inline PageGroupMap& pageGroupMap()
43
{
44
    DEFINE_STATIC_LOCAL(PageGroupMap, map, ());
45
    return map;
46
}
47
40
static WKTypeRef convertFromCharToWKString(void* data)
48
static WKTypeRef convertFromCharToWKString(void* data)
41
{
49
{
42
    return WKStringCreateWithUTF8CString(static_cast<char*>(data));
50
    return WKStringCreateWithUTF8CString(static_cast<char*>(data));
43
}
51
}
44
52
53
PassRefPtr<EwkPageGroup> EwkPageGroup::findOrCreateWrapper(WKPageGroupRef pageGroupRef)
54
{
55
    if (pageGroupMap().contains(pageGroupRef))
56
        return pageGroupMap().get(pageGroupRef);
57
58
    return adoptRef(new EwkPageGroup(pageGroupRef));
59
}
60
61
PassRefPtr<EwkPageGroup> EwkPageGroup::create(const String& identifier)
62
{
63
    WKRetainPtr<WKStringRef> identifierRef = adoptWK(toCopiedAPI(identifier.isEmpty() ? defaultIdentifier : identifier));
64
    WKRetainPtr<WKPageGroupRef> pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(identifierRef.get()));
65
66
    return adoptRef(new EwkPageGroup(pageGroupRef.get()));
67
}
68
45
EwkPageGroup::EwkPageGroup(WKPageGroupRef pageGroupRef)
69
EwkPageGroup::EwkPageGroup(WKPageGroupRef pageGroupRef)
46
    : m_pageGroupRef(pageGroupRef)
70
    : m_pageGroupRef(pageGroupRef)
47
{
71
{
72
    PageGroupMap::AddResult result = pageGroupMap().add(pageGroupRef, this);
73
    ASSERT_UNUSED(result, result.isNewEntry);
48
}
74
}
49
75
50
EwkPageGroup::EwkPageGroup(const String& identifier)
76
EwkPageGroup::~EwkPageGroup()
51
{
77
{
52
    m_pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(adoptWK(toCopiedAPI(identifier)).get()));
78
    ASSERT(pageGroupMap().get(m_pageGroupRef.get()) == this);
79
    pageGroupMap().remove(m_pageGroupRef.get());
53
}
80
}
54
81
55
void EwkPageGroup::addUserStyleSheet(const String& source, const String& baseURL, Eina_List* whiteList, Eina_List* blackList, bool mainFrameOnly)
82
void EwkPageGroup::addUserStyleSheet(const String& source, const String& baseURL, Eina_List* whiteList, Eina_List* blackList, bool mainFrameOnly)
- a/Source/WebKit2/UIProcess/API/efl/ewk_page_group_private.h -13 / +4 lines
Lines 40-57 class EwkPageGroup : public EwkObject { a/Source/WebKit2/UIProcess/API/efl/ewk_page_group_private.h_sec1
40
public:
40
public:
41
    EWK_OBJECT_DECLARE(EwkPageGroup)
41
    EWK_OBJECT_DECLARE(EwkPageGroup)
42
42
43
    static PassRefPtr<EwkPageGroup> create(WKPageGroupRef pageGroupRef)
43
    static PassRefPtr<EwkPageGroup> findOrCreateWrapper(WKPageGroupRef pageGroupRef);
44
    {
44
    static PassRefPtr<EwkPageGroup> create(const String& identifier = String());
45
        if (!pageGroupRef)
46
            return adoptRef(new EwkPageGroup(defaultIdentifier));
47
45
48
        return adoptRef(new EwkPageGroup(pageGroupRef));
46
    ~EwkPageGroup();
49
    }
50
51
    static PassRefPtr<EwkPageGroup> create(const String& identifier = String())
52
    {
53
        return adoptRef(new EwkPageGroup(identifier.isEmpty() ? defaultIdentifier : identifier));
54
    }
55
47
56
    WKPageGroupRef wkPageGroup() const { return m_pageGroupRef.get(); }
48
    WKPageGroupRef wkPageGroup() const { return m_pageGroupRef.get(); }
57
49
Lines 59-66 public: a/Source/WebKit2/UIProcess/API/efl/ewk_page_group_private.h_sec2
59
    void removeAllUserStyleSheets();
51
    void removeAllUserStyleSheets();
60
52
61
private:
53
private:
62
    explicit EwkPageGroup(WKPageGroupRef pageGroupRef);
54
    explicit EwkPageGroup(WKPageGroupRef pageGroupRef);    
63
    explicit EwkPageGroup(const String& identifier);
64
55
65
    static const char defaultIdentifier[];
56
    static const char defaultIdentifier[];
66
57
- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp -1 / +1 lines
Lines 101-107 WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp_sec1
101
101
102
    // FIXME: Refactor to use WKViewRef.
102
    // FIXME: Refactor to use WKViewRef.
103
    WKContextRef contextRef = toAPI(page()->process()->context());
103
    WKContextRef contextRef = toAPI(page()->process()->context());
104
    m_inspectorView = EwkView::createEvasObject(ecore_evas_get(m_inspectorWindow), EwkContext::findOrCreateWrapper(contextRef), EwkPageGroup::create(toAPI(inspectorPageGroup())), EwkView::LegacyBehavior);
104
    m_inspectorView = EwkView::createEvasObject(ecore_evas_get(m_inspectorWindow), EwkContext::findOrCreateWrapper(contextRef), EwkPageGroup::findOrCreateWrapper(toAPI(inspectorPageGroup())), EwkView::LegacyBehavior);
105
    if (!m_inspectorView)
105
    if (!m_inspectorView)
106
        return 0;
106
        return 0;
107
107

Return to Bug 112364