Commit fd91b0e1 authored by darin@chromium.org's avatar darin@chromium.org
Browse files

2010-01-05 Darin Fisher <darin@chromium.org>

        Reviewed by Adam Barth.

        [Chromium] Expose more APIs to eliminate WebCore usage in Chromium.
        https://bugs.webkit.org/show_bug.cgi?id=33249

        * WebKit.gyp:
        * public/WebFrame.h:
        * public/WebGlyphCache.h: Added.
        * public/WebKit.h:
        * src/WebFrameImpl.cpp:
        (WebKit::WebFrame::instanceCount):
        (WebKit::WebFrameImpl::WebFrameImpl):
        (WebKit::WebFrameImpl::~WebFrameImpl):
        * src/WebFrameImpl.h:
        * src/WebGlyphCache.cpp: Added.
        (WebKit::WebGlyphCache::pageCount):
        * src/WebKit.cpp:
        (WebKit::enableLogChannel):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 567c8f2b
2010-01-05 Darin Fisher <darin@chromium.org>
Reviewed by Adam Barth.
[Chromium] Expose more APIs to eliminate WebCore usage in Chromium.
https://bugs.webkit.org/show_bug.cgi?id=33249
* WebKit.gyp:
* public/WebFrame.h:
* public/WebGlyphCache.h: Added.
* public/WebKit.h:
* src/WebFrameImpl.cpp:
(WebKit::WebFrame::instanceCount):
(WebKit::WebFrameImpl::WebFrameImpl):
(WebKit::WebFrameImpl::~WebFrameImpl):
* src/WebFrameImpl.h:
* src/WebGlyphCache.cpp: Added.
(WebKit::WebGlyphCache::pageCount):
* src/WebKit.cpp:
(WebKit::enableLogChannel):
2010-01-05 Adam Barth <abarth@webkit.org>
Reviewed by Dimitri Glazkov.
......
......@@ -123,6 +123,7 @@
'public/WebFrameClient.h',
'public/WebFontCache.h',
'public/WebFormElement.h',
'public/WebGlyphCache.h',
'public/WebHistoryItem.h',
'public/WebHTTPBody.h',
'public/WebImage.h',
......@@ -272,6 +273,7 @@
'src/WebFormElement.cpp',
'src/WebFrameImpl.cpp',
'src/WebFrameImpl.h',
'src/WebGlyphCache.cpp',
'src/WebHistoryItem.cpp',
'src/WebHTTPBody.cpp',
'src/WebImageCG.cpp',
......
......@@ -69,6 +69,9 @@ template <typename T> class WebVector;
class WebFrame {
public:
// Returns the number of live WebFrame objects, used for leak checking.
WEBKIT_API static int instanceCount();
// The two functions below retrieve the WebFrame instances relating the
// currently executing JavaScript. Since JavaScript can make function
// calls across frames, though, we need to be more precise.
......
/*
* Copyright (C) 2010 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
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebGlyphCache_h
#define WebGlyphCache_h
#include "WebCommon.h"
namespace WebKit {
// An interface to query WebKit's glyph cache (which maps unicode characters to
// glyphs in particular fonts).
class WebGlyphCache {
public:
// Returns the number of pages in the glyph cache.
WEBKIT_API static size_t pageCount();
private:
WebGlyphCache(); // Not intended to be instanced.
};
} // namespace WebKit
#endif
......@@ -55,6 +55,9 @@ WEBKIT_API WebKitClient* webKitClient();
WEBKIT_API void setLayoutTestMode(bool);
WEBKIT_API bool layoutTestMode();
// Enables the named log channel. See WebCore/platform/Logging.h for details.
WEBKIT_API void enableLogChannel(const char*);
// Purge the plugin list cache. If |reloadPages| is true, any pages
// containing plugins will be reloaded after refreshing the plugin list.
WEBKIT_API void resetPluginCache(bool reloadPages);
......
......@@ -157,6 +157,8 @@ using namespace WebCore;
namespace WebKit {
static int frameCount = 0;
// Key for a StatsCounter tracking how many WebFrames are active.
static const char* const webFrameActiveCount = "WebFrameActiveCount";
......@@ -332,6 +334,11 @@ private:
// WebFrame -------------------------------------------------------------------
int WebFrame::instanceCount()
{
return frameCount;
}
WebFrame* WebFrame::frameForEnteredContext()
{
Frame* frame =
......@@ -1492,8 +1499,6 @@ WebString WebFrameImpl::counterValueForElementById(const WebString& id) const
// WebFrameImpl public ---------------------------------------------------------
int WebFrameImpl::m_liveObjectCount = 0;
PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client)
{
return adoptRef(new WebFrameImpl(client));
......@@ -1514,13 +1519,13 @@ WebFrameImpl::WebFrameImpl(WebFrameClient* client)
, m_animationController(this)
{
ChromiumBridge::incrementStatsCounter(webFrameActiveCount);
m_liveObjectCount++;
frameCount++;
}
WebFrameImpl::~WebFrameImpl()
{
ChromiumBridge::decrementStatsCounter(webFrameActiveCount);
m_liveObjectCount--;
frameCount--;
cancelPendingScopingEffort();
clearPasswordListeners();
......
......@@ -167,8 +167,6 @@ public:
static PassRefPtr<WebFrameImpl> create(WebFrameClient* client);
~WebFrameImpl();
static int liveObjectCount() { return m_liveObjectCount; }
// Called by the WebViewImpl to initialize its main frame:
void initializeAsMainFrame(WebViewImpl*);
......@@ -283,9 +281,6 @@ private:
void loadJavaScriptURL(const WebCore::KURL&);
// Used to check for leaks of this object.
static int m_liveObjectCount;
FrameLoaderClientImpl m_frameLoaderClient;
WebFrameClient* m_client;
......
/*
* Copyright (C) 2010 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
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "WebGlyphCache.h"
#include "GlyphPageTreeNode.h"
using namespace WebCore;
namespace WebKit {
size_t WebGlyphCache::pageCount()
{
return GlyphPageTreeNode::treeGlyphPageCount();
}
} // namespace WebKit
......@@ -94,6 +94,13 @@ bool layoutTestMode()
return s_layoutTestMode;
}
void enableLogChannel(const char* name)
{
WTFLogChannel* channel = WebCore::getChannelFromName(name);
if (channel)
channel->state = WTFLogChannelOn;
}
void resetPluginCache(bool reloadPages)
{
WebCore::Page::refreshPlugins(reloadPages);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment