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

Unified Diff: ppapi/shared_impl/ppapi_message_tracker.h

Issue 10909241: Generate dumps for relevant renderers when users kill a hung pepper plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dump&kill in blocking pool instead of on IO thread. Created 8 years, 3 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 | « ppapi/proxy/host_dispatcher.cc ('k') | ppapi/shared_impl/ppapi_message_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/ppapi_message_tracker.h
diff --git a/ppapi/shared_impl/ppapi_message_tracker.h b/ppapi/shared_impl/ppapi_message_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..d817b9763b71eaf8f428b227dc13940147368605
--- /dev/null
+++ b/ppapi/shared_impl/ppapi_message_tracker.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_PPAPI_MESSAGE_TRACKER_H_
+#define PPAPI_SHARED_IMPL_PPAPI_MESSAGE_TRACKER_H_
+
+#include "base/basictypes.h"
+#include "base/synchronization/lock.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+namespace ppapi {
+
+// PpapiMessageTracker uses a counter to record whether anyone is sending or
+// receiving pepper messages in the current process.
+// This class is thread safe.
+class PPAPI_SHARED_EXPORT PpapiMessageTracker {
+ public:
+ static PpapiMessageTracker* GetInstance();
+
+ void EnterMessageHandling();
+ void ExitMessageHandling();
+ bool IsHandlingMessage();
+
+ private:
+ friend struct DefaultSingletonTraits<PpapiMessageTracker>;
+
+ PpapiMessageTracker();
+ ~PpapiMessageTracker();
+
+ base::Lock lock_;
+ int enter_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(PpapiMessageTracker);
+};
+
+class PPAPI_SHARED_EXPORT ScopedTrackPpapiMessage {
+ public:
+ ScopedTrackPpapiMessage();
+ ~ScopedTrackPpapiMessage();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedTrackPpapiMessage);
+};
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_PPAPI_MESSAGE_TRACKER_H_
« no previous file with comments | « ppapi/proxy/host_dispatcher.cc ('k') | ppapi/shared_impl/ppapi_message_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698