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

Unified Diff: content/browser/renderer_host/routing_id_issuer.h

Issue 643733002: Add RoutingIDIssuer to ensure the correctness of ID to be routed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 6 years, 2 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
Index: content/browser/renderer_host/routing_id_issuer.h
diff --git a/content/browser/renderer_host/routing_id_issuer.h b/content/browser/renderer_host/routing_id_issuer.h
new file mode 100644
index 0000000000000000000000000000000000000000..36fc452e0433d48bc63f3e7220576a765103d4a6
--- /dev/null
+++ b/content/browser/renderer_host/routing_id_issuer.h
@@ -0,0 +1,44 @@
+// Copyright 2014 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 CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_
+
+#include "base/atomic_sequence_num.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
+#include "content/common/content_export.h"
+#include "ipc/ipc_message.h"
+
+namespace content {
+
+// A debug facility for tightening the routing ID usage across multiple
+// RenderProcessHost. The tracked ID is used by RenderProcessHost
+// to verify if the given ID is correct.
+class CONTENT_EXPORT RoutingIDIssuer {
+ public:
+ static scoped_ptr<RoutingIDIssuer> Create();
+ static scoped_ptr<RoutingIDIssuer> CreateWithMangler(int mangler);
+
+ int IssueNext();
+ bool IsProbablyValid(int issued_id) const;
+
+ private:
+ friend class RoutingIDManglingDisabler;
+
+ static void DisableIDMangling();
+ static void EnableIDMangling();
+
+ explicit RoutingIDIssuer(int mangler);
+
+ base::AtomicSequenceNumber next_;
+ const int mangler_;
+
+ DISALLOW_COPY_AND_ASSIGN(RoutingIDIssuer);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_
« no previous file with comments | « content/browser/renderer_host/render_widget_helper.cc ('k') | content/browser/renderer_host/routing_id_issuer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698