Commit b207f31f authored by piman@chromium.org's avatar piman@chromium.org

Add traces in compositor, views and skia

BUG=None
TEST=None


Review URL: http://codereview.chromium.org/8440008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108174 0039d316-1c4b-4281-b951-d872f2087c98
parent f3ddcadf
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
#include "base/debug/trace_event.h"
#include "skia/ext/bitmap_platform_device.h" #include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/platform_device.h" #include "skia/ext/platform_device.h"
#include "third_party/skia/include/core/SkTypes.h" #include "third_party/skia/include/core/SkTypes.h"
...@@ -11,12 +12,16 @@ ...@@ -11,12 +12,16 @@
namespace skia { namespace skia {
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) { PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
if (!initialize(width, height, is_opaque)) if (!initialize(width, height, is_opaque))
SK_CRASH(); SK_CRASH();
} }
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque, PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque,
uint8_t* data) { uint8_t* data) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
if (!initialize(width, height, is_opaque, data)) if (!initialize(width, height, is_opaque, data))
SK_CRASH(); SK_CRASH();
} }
......
...@@ -4,12 +4,15 @@ ...@@ -4,12 +4,15 @@
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
#include "base/debug/trace_event.h"
#include "skia/ext/bitmap_platform_device.h" #include "skia/ext/bitmap_platform_device.h"
#include "third_party/skia/include/core/SkTypes.h" #include "third_party/skia/include/core/SkTypes.h"
namespace skia { namespace skia {
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) { PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
initialize(width, height, is_opaque); initialize(width, height, is_opaque);
} }
...@@ -17,6 +20,8 @@ PlatformCanvas::PlatformCanvas(int width, ...@@ -17,6 +20,8 @@ PlatformCanvas::PlatformCanvas(int width,
int height, int height,
bool is_opaque, bool is_opaque,
CGContextRef context) { CGContextRef context) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
initialize(context, width, height, is_opaque); initialize(context, width, height, is_opaque);
} }
...@@ -24,6 +29,8 @@ PlatformCanvas::PlatformCanvas(int width, ...@@ -24,6 +29,8 @@ PlatformCanvas::PlatformCanvas(int width,
int height, int height,
bool is_opaque, bool is_opaque,
uint8_t* data) { uint8_t* data) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
initialize(width, height, is_opaque, data); initialize(width, height, is_opaque, data);
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <windows.h> #include <windows.h>
#include <psapi.h> #include <psapi.h>
#include "base/debug/trace_event.h"
#include "skia/ext/bitmap_platform_device_win.h" #include "skia/ext/bitmap_platform_device_win.h"
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
...@@ -77,6 +78,8 @@ void CrashIfInvalidSection(HANDLE shared_section) { ...@@ -77,6 +78,8 @@ void CrashIfInvalidSection(HANDLE shared_section) {
#pragma optimize("", on) #pragma optimize("", on)
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) { PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
bool initialized = initialize(width, height, is_opaque, NULL); bool initialized = initialize(width, height, is_opaque, NULL);
if (!initialized) if (!initialized)
CrashForBitmapAllocationFailure(width, height); CrashForBitmapAllocationFailure(width, height);
...@@ -86,6 +89,8 @@ PlatformCanvas::PlatformCanvas(int width, ...@@ -86,6 +89,8 @@ PlatformCanvas::PlatformCanvas(int width,
int height, int height,
bool is_opaque, bool is_opaque,
HANDLE shared_section) { HANDLE shared_section) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
bool initialized = initialize(width, height, is_opaque, shared_section); bool initialized = initialize(width, height, is_opaque, shared_section);
if (!initialized) { if (!initialized) {
CrashIfInvalidSection(shared_section); CrashIfInvalidSection(shared_section);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/debug/trace_event.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
...@@ -336,6 +337,7 @@ TextureGL::~TextureGL() { ...@@ -336,6 +337,7 @@ TextureGL::~TextureGL() {
void TextureGL::SetCanvas(const SkCanvas& canvas, void TextureGL::SetCanvas(const SkCanvas& canvas,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& overall_size) { const gfx::Size& overall_size) {
TRACE_EVENT0("ui", "TextureGL::SetCanvas");
const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false); const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false);
// Verify bitmap pixels are contiguous. // Verify bitmap pixels are contiguous.
DCHECK_EQ(bitmap.rowBytes(), DCHECK_EQ(bitmap.rowBytes(),
...@@ -374,6 +376,7 @@ void TextureGL::SetCanvas(const SkCanvas& canvas, ...@@ -374,6 +376,7 @@ void TextureGL::SetCanvas(const SkCanvas& canvas,
void TextureGL::Draw(const ui::TextureDrawParams& params, void TextureGL::Draw(const ui::TextureDrawParams& params,
const gfx::Rect& clip_bounds_in_texture) { const gfx::Rect& clip_bounds_in_texture) {
TRACE_EVENT0("ui", "TextureGL::Draw");
SharedResourcesGL* instance = SharedResourcesGL::GetInstance(); SharedResourcesGL* instance = SharedResourcesGL::GetInstance();
DCHECK(instance); DCHECK(instance);
DrawInternal(*instance->program_swizzle(), DrawInternal(*instance->program_swizzle(),
...@@ -515,6 +518,7 @@ Texture* CompositorGL::CreateTexture() { ...@@ -515,6 +518,7 @@ Texture* CompositorGL::CreateTexture() {
} }
void CompositorGL::OnNotifyStart(bool clear) { void CompositorGL::OnNotifyStart(bool clear) {
TRACE_EVENT0("ui", "CompositorGL::OnNotifyStart");
started_ = true; started_ = true;
gl_context_->MakeCurrent(gl_surface_.get()); gl_context_->MakeCurrent(gl_surface_.get());
glViewport(0, 0, size().width(), size().height()); glViewport(0, 0, size().width(), size().height());
...@@ -535,6 +539,7 @@ void CompositorGL::OnNotifyStart(bool clear) { ...@@ -535,6 +539,7 @@ void CompositorGL::OnNotifyStart(bool clear) {
} }
void CompositorGL::OnNotifyEnd() { void CompositorGL::OnNotifyEnd() {
TRACE_EVENT0("ui", "CompositorGL::OnNotifyEnd");
DCHECK(started_); DCHECK(started_);
gl_surface_->SwapBuffers(); gl_surface_->SwapBuffers();
started_ = false; started_ = false;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <algorithm> #include <algorithm>
#include "base/debug/trace_event.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayer.h"
...@@ -304,6 +305,7 @@ void Layer::ScheduleDraw() { ...@@ -304,6 +305,7 @@ void Layer::ScheduleDraw() {
} }
void Layer::Draw() { void Layer::Draw() {
TRACE_EVENT0("ui", "Layer::Draw");
#if defined(USE_WEBKIT_COMPOSITOR) #if defined(USE_WEBKIT_COMPOSITOR)
NOTREACHED(); NOTREACHED();
#else #else
...@@ -376,6 +378,7 @@ void Layer::notifyNeedsComposite() { ...@@ -376,6 +378,7 @@ void Layer::notifyNeedsComposite() {
void Layer::paintContents(WebKit::WebCanvas* web_canvas, void Layer::paintContents(WebKit::WebCanvas* web_canvas,
const WebKit::WebRect& clip) { const WebKit::WebRect& clip) {
TRACE_EVENT0("ui", "Layer::paintContents");
#if defined(USE_WEBKIT_COMPOSITOR) #if defined(USE_WEBKIT_COMPOSITOR)
gfx::CanvasSkia canvas(web_canvas); gfx::CanvasSkia canvas(web_canvas);
delegate_->OnPaintLayer(&canvas); delegate_->OnPaintLayer(&canvas);
...@@ -395,6 +398,7 @@ float Layer::GetCombinedOpacity() const { ...@@ -395,6 +398,7 @@ float Layer::GetCombinedOpacity() const {
} }
void Layer::UpdateLayerCanvas() { void Layer::UpdateLayerCanvas() {
TRACE_EVENT0("ui", "Layer::UpdateLayerCanvas");
#if defined(USE_WEBKIT_COMPOSITOR) #if defined(USE_WEBKIT_COMPOSITOR)
NOTREACHED(); NOTREACHED();
#else #else
......
...@@ -652,7 +652,7 @@ void View::SchedulePaintInRect(const gfx::Rect& rect) { ...@@ -652,7 +652,7 @@ void View::SchedulePaintInRect(const gfx::Rect& rect) {
} }
void View::Paint(gfx::Canvas* canvas) { void View::Paint(gfx::Canvas* canvas) {
TRACE_EVENT0("View", "Paint"); TRACE_EVENT0("views", "View::Paint");
ScopedCanvas scoped_canvas(canvas); ScopedCanvas scoped_canvas(canvas);
...@@ -1044,30 +1044,44 @@ void View::NativeViewHierarchyChanged(bool attached, ...@@ -1044,30 +1044,44 @@ void View::NativeViewHierarchyChanged(bool attached,
// Painting -------------------------------------------------------------------- // Painting --------------------------------------------------------------------
void View::PaintChildren(gfx::Canvas* canvas) { void View::PaintChildren(gfx::Canvas* canvas) {
TRACE_EVENT0("views", "View::PaintChildren");
for (int i = 0, count = child_count(); i < count; ++i) for (int i = 0, count = child_count(); i < count; ++i)
if (!child_at(i)->layer()) if (!child_at(i)->layer())
child_at(i)->Paint(canvas); child_at(i)->Paint(canvas);
} }
void View::OnPaint(gfx::Canvas* canvas) { void View::OnPaint(gfx::Canvas* canvas) {
TRACE_EVENT0("views", "View::OnPaint");
OnPaintBackground(canvas); OnPaintBackground(canvas);
OnPaintFocusBorder(canvas); OnPaintFocusBorder(canvas);
OnPaintBorder(canvas); OnPaintBorder(canvas);
} }
void View::OnPaintBackground(gfx::Canvas* canvas) { void View::OnPaintBackground(gfx::Canvas* canvas) {
if (background_.get()) if (background_.get()) {
TRACE_EVENT2("views", "View::OnPaintBackground",
"width", canvas->GetSkCanvas()->getDevice()->width(),
"height", canvas->GetSkCanvas()->getDevice()->height());
background_->Paint(canvas, this); background_->Paint(canvas, this);
}
} }
void View::OnPaintBorder(gfx::Canvas* canvas) { void View::OnPaintBorder(gfx::Canvas* canvas) {
if (border_.get()) if (border_.get()) {
TRACE_EVENT2("views", "View::OnPaintBorder",
"width", canvas->GetSkCanvas()->getDevice()->width(),
"height", canvas->GetSkCanvas()->getDevice()->height());
border_->Paint(*this, canvas); border_->Paint(*this, canvas);
}
} }
void View::OnPaintFocusBorder(gfx::Canvas* canvas) { void View::OnPaintFocusBorder(gfx::Canvas* canvas) {
if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) {
TRACE_EVENT2("views", "views::OnPaintFocusBorder",
"width", canvas->GetSkCanvas()->getDevice()->width(),
"height", canvas->GetSkCanvas()->getDevice()->height());
canvas->DrawFocusRect(GetLocalBounds()); canvas->DrawFocusRect(GetLocalBounds());
}
} }
// Accelerated Painting -------------------------------------------------------- // Accelerated Painting --------------------------------------------------------
......
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