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

Unified Diff: third_party/WebKit/Source/core/inspector/MuteConsoleScope.h

Issue 1442953002: Oilpan: turn MuteConsoleScope into a stack allocated object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix init Created 5 years, 1 month 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 | « third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/inspector/MuteConsoleScope.h
diff --git a/third_party/WebKit/Source/core/inspector/MuteConsoleScope.h b/third_party/WebKit/Source/core/inspector/MuteConsoleScope.h
index c5d323b382b32867069e48b17589d55322bbaa96..b141fec8d1b746596569f441158d4cdff6e1761a 100644
--- a/third_party/WebKit/Source/core/inspector/MuteConsoleScope.h
+++ b/third_party/WebKit/Source/core/inspector/MuteConsoleScope.h
@@ -5,22 +5,44 @@
#ifndef MuteConsoleScope_h
#define MuteConsoleScope_h
+#include "platform/heap/Handle.h"
+
namespace blink {
template <class T>
class MuteConsoleScope {
+ STACK_ALLOCATED();
public:
- explicit MuteConsoleScope(T* agent) : m_agent(agent)
+ MuteConsoleScope()
{
- m_agent->muteConsole();
+ }
+ explicit MuteConsoleScope(T* agent)
+ {
+ enter(agent);
}
~MuteConsoleScope()
{
+ exit();
+ }
+
+ void enter(T* agent)
+ {
+ ASSERT(!m_agent);
+ m_agent = agent;
+ m_agent->muteConsole();
+ }
+
+ void exit()
+ {
+ if (!m_agent)
+ return;
+
m_agent->unmuteConsole();
+ m_agent = nullptr;
}
private:
- T* m_agent;
+ RawPtrWillBeMember<T> m_agent = nullptr;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorRuntimeAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698