diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-24 22:10:20 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-24 22:10:20 +0000 |
commit | 6bd867b0c6db7782ad5afae9d990e924bfc6d311 (patch) | |
tree | 41c1d97aa4d0a262fa3105087d272c5a327dd078 | |
parent | d5f52957f885b07309142180cbc6a06f2a36e25a (diff) | |
download | chromium_src-6bd867b0c6db7782ad5afae9d990e924bfc6d311.zip chromium_src-6bd867b0c6db7782ad5afae9d990e924bfc6d311.tar.gz chromium_src-6bd867b0c6db7782ad5afae9d990e924bfc6d311.tar.bz2 |
Thin out webkit_glue.{h,cc} a bit more.
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/19931009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213529 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/renderer/render_process_impl.cc | 7 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.cc | 12 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 8 | ||||
-rw-r--r-- | content/renderer/render_widget.cc | 6 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 59 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 23 |
6 files changed, 22 insertions, 93 deletions
diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc index 29bdba3..79b5b077 100644 --- a/content/renderer/render_process_impl.cc +++ b/content/renderer/render_process_impl.cc @@ -27,6 +27,7 @@ #include "ipc/ipc_channel.h" #include "ipc/ipc_message_utils.h" #include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/public/web/WebFrame.h" #include "ui/surface/transport_dib.h" #include "webkit/glue/webkit_glue.h" @@ -77,10 +78,10 @@ RenderProcessImpl::RenderProcessImpl() } RenderProcessImpl::~RenderProcessImpl() { - // TODO(port): Try and limit what we pull in for our non-Win unit test bundle. #ifndef NDEBUG - // log important leaked objects - webkit_glue::CheckForLeaks(); + int count = WebKit::WebFrame::instanceCount(); + if (count) + DLOG(ERROR) << "WebFrame LEAKED " << count << " TIMES"; #endif GetShutDownEvent()->Signal(); diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index a3a9a4f..7adc22f 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -21,7 +21,7 @@ #include "base/metrics/stats_table.h" #include "base/path_service.h" #include "base/strings/string16.h" -#include "base/strings/string_number_conversions.h" // Temporary +#include "base/strings/string_tokenizer.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_local.h" #include "base/threading/thread_restrictions.h" @@ -225,6 +225,14 @@ scoped_ptr<base::SharedMemory> AllocateSharedMemoryFunction(size_t size) { return RenderThreadImpl::Get()->HostAllocateSharedMemoryBuffer(size); } +void EnableWebCoreLogChannels(const std::string& channels) { + if (channels.empty()) + return; + base::StringTokenizer t(channels, ", "); + while (t.GetNext()) + WebKit::enableLogChannel(t.token().c_str()); +} + } // namespace class RenderThreadImpl::GpuVDAContextLostCallback @@ -722,7 +730,7 @@ void RenderThreadImpl::EnsureWebKitInitialized() { RenderThreadImpl::RegisterSchemes(); - webkit_glue::EnableWebCoreLogChannels( + EnableWebCoreLogChannels( command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); web_database_observer_impl_.reset( diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index c5681bc..82f7a81 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -170,6 +170,7 @@ #include "third_party/WebKit/public/web/WebFormControlElement.h" #include "third_party/WebKit/public/web/WebFormElement.h" #include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebGlyphCache.h" #include "third_party/WebKit/public/web/WebHelperPlugin.h" #include "third_party/WebKit/public/web/WebHistoryItem.h" #include "third_party/WebKit/public/web/WebInputElement.h" @@ -206,7 +207,6 @@ #include "v8/include/v8.h" #include "webkit/child/weburlresponse_extradata_impl.h" #include "webkit/common/dom_storage/dom_storage_types.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/renderer/appcache/web_application_cache_host_impl.h" #include "webkit/renderer/webpreferences_renderer.h" @@ -1936,7 +1936,7 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) { // Save some histogram data so we can compute the average memory used per // page load of the glyphs. UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", - webkit_glue::GetGlyphPageCount()); + WebKit::WebGlyphCache::pageCount()); // This message needs to be sent before any of allowScripts(), // allowImages(), allowPlugins() is called for the new page, so that when @@ -6290,7 +6290,9 @@ bool RenderViewImpl::didTapMultipleTargets( canvas->translate(-zoom_rect.x() * device_scale_factor_, -zoom_rect.y() * device_scale_factor_); - webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect, + webwidget_->paint( + canvas.get(), + zoom_rect, WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent); } diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 46f420d..e3976f6 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -57,7 +57,6 @@ #include "ui/gfx/skia_util.h" #include "ui/gl/gl_switches.h" #include "ui/surface/transport_dib.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" #include "webkit/renderer/cursor_utils.h" @@ -998,8 +997,7 @@ void RenderWidget::PaintRect(const gfx::Rect& rect, SkAutoCanvasRestore auto_restore(canvas, true); canvas->scale(device_scale_factor_, device_scale_factor_); - optimized_instance->Paint(webkit_glue::ToWebCanvas(canvas), - optimized_copy_location, rect); + optimized_instance->Paint(canvas, optimized_copy_location, rect); canvas->restore(); if (kEnableGpuBenchmarking) { base::TimeDelta paint_time = @@ -1013,7 +1011,7 @@ void RenderWidget::PaintRect(const gfx::Rect& rect, if (kEnableGpuBenchmarking) paint_begin_ticks = base::TimeTicks::HighResNow(); - webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect); + webwidget_->paint(canvas, rect); if (kEnableGpuBenchmarking) { base::TimeDelta paint_time = diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 4c832f3..30b03e5 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -4,65 +4,16 @@ #include "webkit/glue/webkit_glue.h" -#if defined(OS_LINUX) -#include <malloc.h> -#endif - #include "base/logging.h" -#include "base/memory/scoped_ptr.h" -#include "base/process_util.h" -#include "base/strings/string_tokenizer.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "net/base/escape.h" -#include "skia/ext/platform_canvas.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" -#include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/WebKit/public/web/WebGlyphCache.h" -#include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "v8/include/v8.h" -using WebKit::WebCanvas; -using WebKit::WebFrame; -using WebKit::WebGlyphCache; - -//------------------------------------------------------------------------------ -// webkit_glue impl: - namespace webkit_glue { void SetJavaScriptFlags(const std::string& str) { v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); } -void EnableWebCoreLogChannels(const std::string& channels) { - if (channels.empty()) - return; - base::StringTokenizer t(channels, ", "); - while (t.GetNext()) { - WebKit::enableLogChannel(t.token().c_str()); - } -} - -#ifndef NDEBUG -// The log macro was having problems due to collisions with WTF, so we just -// code here what that would have inlined. -void DumpLeakedObject(const char* file, int line, const char* object, - int count) { - std::string msg = base::StringPrintf("%s LEAKED %d TIMES", object, count); - logging::LogMessage(file, line).stream() << msg; -} -#endif - -void CheckForLeaks() { -#ifndef NDEBUG - int count = WebFrame::instanceCount(); - if (count) - DumpLeakedObject(__FILE__, __LINE__, "WebFrame", count); -#endif -} - void PlatformFileInfoToWebFileInfo( const base::PlatformFileInfo& file_info, WebKit::WebFileInfo* web_file_info) { @@ -79,14 +30,6 @@ void PlatformFileInfoToWebFileInfo( web_file_info->type = WebKit::WebFileInfo::TypeFile; } -WebCanvas* ToWebCanvas(skia::PlatformCanvas* canvas) { - return canvas; -} - -int GetGlyphPageCount() { - return WebGlyphCache::pageCount(); -} - COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); -} // namespace webkit_glue +} // namespace webkit_glue diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 33fed9f..c396015 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -7,14 +7,9 @@ #include <string> -#include "base/basictypes.h" #include "base/platform_file.h" -#include "base/strings/string16.h" -#include "third_party/WebKit/public/platform/WebCanvas.h" #include "webkit/glue/webkit_glue_export.h" -class SkCanvas; - namespace WebKit { struct WebFileInfo; } @@ -23,29 +18,11 @@ namespace webkit_glue { WEBKIT_GLUE_EXPORT void SetJavaScriptFlags(const std::string& flags); -// Turn on logging for flags in the provided comma delimited list. -WEBKIT_GLUE_EXPORT void EnableWebCoreLogChannels(const std::string& channels); - -#ifndef NDEBUG -// Checks various important objects to see if there are any in memory, and -// calls AppendToLog with any leaked objects. Designed to be called on -// shutdown. -WEBKIT_GLUE_EXPORT void CheckForLeaks(); -#endif - // File info conversion WEBKIT_GLUE_EXPORT void PlatformFileInfoToWebFileInfo( const base::PlatformFileInfo& file_info, WebKit::WebFileInfo* web_file_info); -// Returns a WebCanvas pointer associated with the given Skia canvas. -WEBKIT_GLUE_EXPORT WebKit::WebCanvas* ToWebCanvas(SkCanvas*); - -// Returns the number of currently-active glyph pages this process is using. -// There can be many such pages (maps of 256 character -> glyph) so this is -// used to get memory usage statistics. -WEBKIT_GLUE_EXPORT int GetGlyphPageCount(); - } // namespace webkit_glue #endif // WEBKIT_GLUE_WEBKIT_GLUE_H_ |