OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_ |
| 7 |
| 8 #include "base/atomic_sequence_num.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/synchronization/lock.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "ipc/ipc_message.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // A debug facility for tightening the routing ID usage across multiple |
| 18 // RenderProcessHost. The tracked ID is used by RenderProcessHost |
| 19 // to verify if the given ID is correct. |
| 20 class CONTENT_EXPORT RoutingIDIssuer { |
| 21 public: |
| 22 static scoped_ptr<RoutingIDIssuer> Create(); |
| 23 static scoped_ptr<RoutingIDIssuer> CreateWithMangler(int mangler); |
| 24 |
| 25 int IssueNext(); |
| 26 bool IsProbablyValid(int issued_id) const; |
| 27 |
| 28 private: |
| 29 friend class RoutingIDManglingDisabler; |
| 30 |
| 31 static void DisableIDMangling(); |
| 32 static void EnableIDMangling(); |
| 33 |
| 34 explicit RoutingIDIssuer(int mangler); |
| 35 |
| 36 base::AtomicSequenceNumber next_; |
| 37 const int mangler_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(RoutingIDIssuer); |
| 40 }; |
| 41 |
| 42 } // namespace content |
| 43 |
| 44 #endif // CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_ |
OLD | NEW |