Chromium Code Reviews| Index: content/browser/browsing_instance_frame_id.h |
| diff --git a/content/browser/browsing_instance_frame_id.h b/content/browser/browsing_instance_frame_id.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5bfff2f4b202c5a40808cf2ec527d7173e0c791b |
| --- /dev/null |
| +++ b/content/browser/browsing_instance_frame_id.h |
| @@ -0,0 +1,86 @@ |
| +// Copyright (c) 2011 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_WORKER_HOST_BROWSING_INSTANCE_FRAME_ID_H_ |
| +#define CONTENT_BROWSER_WORKER_HOST_BROWSING_INSTANCE_FRAME_ID_H_ |
|
Charlie Reis
2011/12/01 23:13:02
Nit: remove WORKER_HOST
supersat
2011/12/09 23:08:20
Done.
|
| + |
| +#include "base/basictypes.h" |
| +#include "base/hash_tables.h" |
| +#include <list> |
| + |
| +namespace content { |
| +class FrameMapper; |
| + |
| +class BrowsingInstanceFrame { |
|
Charlie Reis
2011/12/01 23:13:02
I don't understand this name. A BrowsingInstance
supersat
2011/12/09 23:08:20
I agree the name could improve. Any suggestions? T
Charlie Reis
2011/12/12 22:20:36
I see that you're trying to get the scope of the I
supersat
2011/12/15 19:30:49
SGTM. Renamed.
|
| + friend class FrameMapper; |
| + |
| + public: |
| + struct WebKitFrameIdTuple { |
| + WebKitFrameIdTuple(int process_host_id, int64 frame_id); |
| + bool operator==(const WebKitFrameIdTuple& other) const; |
| + |
| + int process_host_id; |
| + int64 frame_id; |
| + }; |
| + |
| + BrowsingInstanceFrame(int64 id, bool is_top_level); |
| + virtual ~BrowsingInstanceFrame(); |
| + |
| + int64 id() { return id_; } |
| + |
| + const WebKitFrameIdTuple current_webkit_frame() const { |
| + return current_webkit_frame_; |
| + } |
| + |
| + int current_process_host_id() const { |
| + return current_webkit_frame_.process_host_id; |
| + } |
| + |
| + int current_route_id() const { |
| + return current_route_id_; |
| + } |
| + |
| + int64 current_frame_id() const { |
| + return current_webkit_frame_.frame_id; |
| + } |
| + |
| + bool is_top_level() const { |
| + return is_top_level_; |
| + } |
| + |
| + void UpdateFrame(int new_process_host_id, |
| + int new_route_id, |
| + int64 new_frame_id); |
| + |
| + // TODO(supersat): Not currently used. |
| + BrowsingInstanceFrame* FindById(int64 id); |
| + |
| + private: |
| + int64 id_; |
| + |
| + BrowsingInstanceFrame* parent_; |
| + std::list<BrowsingInstanceFrame*> children_; |
|
Charlie Reis
2011/12/01 23:13:02
Parent and child frames usually refer to the frame
supersat
2011/12/09 23:08:20
I'm actually not sure what I intended these to be
|
| + |
| + WebKitFrameIdTuple current_webkit_frame_; |
| + int current_route_id_; |
| + bool is_top_level_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#if defined(COMPILER_GCC) |
| +namespace __gnu_cxx { |
| + |
| +template<> |
| +struct hash<content::BrowsingInstanceFrame::WebKitFrameIdTuple> { |
| + std::size_t operator()(const |
| + content::BrowsingInstanceFrame::WebKitFrameIdTuple& p) const { |
| + return p.process_host_id * 65537 + p.process_host_id * 257 + p.frame_id; |
| + } |
| +}; |
| + |
| +} // namespace __gnu_cxx |
| +#endif |
| + |
| +#endif // CONTENT_BROWSER_WORKER_HOST_BROWSING_INSTANCE_FRAME_ID_H_ |