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

Unified Diff: extensions/renderer/console.h

Issue 2718133003: Rewrite extensions console to not leak function templates. (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | extensions/renderer/console.cc » ('j') | extensions/renderer/console.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/console.h
diff --git a/extensions/renderer/console.h b/extensions/renderer/console.h
index 79d338e773aa9122b8e457c12842c7d93fab5c76..a8f52af18b834ba39196a05a22163fe8e59eca9d 100644
--- a/extensions/renderer/console.h
+++ b/extensions/renderer/console.h
@@ -21,17 +21,28 @@ namespace console {
// Adds |message| to the console of |render_frame|. If |render_frame| is null,
// LOG()s the message instead.
-void Debug(content::RenderFrame* render_frame, const std::string& message);
-void Log(content::RenderFrame* render_frame, const std::string& message);
-void Warn(content::RenderFrame* render_frame, const std::string& message);
-void Error(content::RenderFrame* render_frame, const std::string& message);
-
-// Logs an Error then crashes the current process.
-void Fatal(content::RenderFrame* render_frame, const std::string& message);
-
void AddMessage(content::RenderFrame* render_frame,
content::ConsoleMessageLevel level,
const std::string& message);
+inline void Debug(content::RenderFrame* render_frame,
Devlin 2017/02/27 22:32:12 Given we now bind these to the same function and j
jbroman 2017/02/27 22:52:49 I'd made it compile-time-inlinable, and I did noti
+ const std::string& message) {
+ AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_VERBOSE, message);
+}
+inline void Log(content::RenderFrame* render_frame,
+ const std::string& message) {
+ AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_INFO, message);
+}
+inline void Warn(content::RenderFrame* render_frame,
+ const std::string& message) {
+ AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_WARNING, message);
+}
+inline void Error(content::RenderFrame* render_frame,
+ const std::string& message) {
+ AddMessage(render_frame, content::CONSOLE_MESSAGE_LEVEL_ERROR, message);
+}
+
+// Logs an Error then crashes the current process.
+void Fatal(content::RenderFrame* render_frame, const std::string& message);
// Returns a new v8::Object with each standard log method (Debug/Log/Warn/Error)
// bound to respective debug/log/warn/error methods. This is a direct drop-in
« no previous file with comments | « no previous file | extensions/renderer/console.cc » ('j') | extensions/renderer/console.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698