Chromium Code Reviews| 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..73f3ce3f373a378b4698abcf36bd1c5a08657302 |
| --- /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 StartDisablingIDMangling(); |
|
nasko
2014/10/13 21:04:01
nit: Those will be more readable if they are "Enab
Hajime Morrita
2014/10/13 22:23:54
Done.
|
| + static void StopDisablingIDMangling(); |
| + |
| + 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_ |