Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: Source/core/platform/PlatformInstrumentation.h

Issue 16878004: DevTools: add instrumentation for deferred canvas rasterization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 virtual void willDecodeImage(const String& imageType) = 0; 45 virtual void willDecodeImage(const String& imageType) = 0;
46 virtual void didDecodeImage() = 0; 46 virtual void didDecodeImage() = 0;
47 virtual void willResizeImage(bool shouldCache) = 0; 47 virtual void willResizeImage(bool shouldCache) = 0;
48 virtual void didResizeImage() = 0; 48 virtual void didResizeImage() = 0;
49 }; 49 };
50 50
51 class PlatformInstrumentation { 51 class PlatformInstrumentation {
52 public: 52 public:
53 static const char ImageDecodeEvent[]; 53 static const char ImageDecodeEvent[];
54 static const char ImageResizeEvent[]; 54 static const char ImageResizeEvent[];
55 static const char RasterizeCanvasEvent[];
55 56
56 static const char ImageTypeArgument[]; 57 static const char ImageTypeArgument[];
57 static const char CachedArgument[]; 58 static const char CachedArgument[];
58 59
59 static void setClient(PlatformInstrumentationClient*); 60 static void setClient(PlatformInstrumentationClient*);
60 static bool hasClient() { return m_client; } 61 static bool hasClient() { return m_client; }
61 62
62 static void willDecodeImage(const String& imageType); 63 static void willDecodeImage(const String& imageType);
63 static void didDecodeImage(); 64 static void didDecodeImage();
64 static void willResizeImage(bool shouldCache); 65 static void willResizeImage(bool shouldCache);
65 static void didResizeImage(); 66 static void didResizeImage();
66 67
68 static void willRasterizeCanvas();
69 static void didRasterizeCanvas();
70
67 private: 71 private:
68 static const char CategoryName[]; 72 static const char CategoryName[];
69 73
70 static PlatformInstrumentationClient* m_client; 74 static PlatformInstrumentationClient* m_client;
71 }; 75 };
72 76
73 #define FAST_RETURN_IF_NO_CLIENT_OR_NOT_MAIN_THREAD() if (!m_client || !isMainTh read()) return; 77 #define FAST_RETURN_IF_NO_CLIENT_OR_NOT_MAIN_THREAD() if (!m_client || !isMainTh read()) return;
74 78
75 inline void PlatformInstrumentation::willDecodeImage(const String& imageType) 79 inline void PlatformInstrumentation::willDecodeImage(const String& imageType)
76 { 80 {
(...skipping 16 matching lines...) Expand all
93 m_client->willResizeImage(shouldCache); 97 m_client->willResizeImage(shouldCache);
94 } 98 }
95 99
96 inline void PlatformInstrumentation::didResizeImage() 100 inline void PlatformInstrumentation::didResizeImage()
97 { 101 {
98 TRACE_EVENT_END0(CategoryName, ImageResizeEvent); 102 TRACE_EVENT_END0(CategoryName, ImageResizeEvent);
99 FAST_RETURN_IF_NO_CLIENT_OR_NOT_MAIN_THREAD(); 103 FAST_RETURN_IF_NO_CLIENT_OR_NOT_MAIN_THREAD();
100 m_client->didResizeImage(); 104 m_client->didResizeImage();
101 } 105 }
102 106
107 inline void PlatformInstrumentation::willRasterizeCanvas()
108 {
109 TRACE_EVENT_BEGIN0(CategoryName, RasterizeCanvasEvent);
110 }
111
112 inline void PlatformInstrumentation::didRasterizeCanvas()
113 {
114 TRACE_EVENT_END0(CategoryName, RasterizeCanvasEvent);
115 }
116
103 } // namespace WebCore 117 } // namespace WebCore
104 118
105 #endif // PlatformInstrumentation_h 119 #endif // PlatformInstrumentation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698