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..3bae0d992a80f9242791be215240aa7543dcf8b0 |
--- /dev/null |
+++ b/content/browser/browsing_instance_frame_id.h |
@@ -0,0 +1,82 @@ |
+// 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_BROWSING_INSTANCE_FRAME_ID_H_ |
+#define CONTENT_BROWSER_BROWSING_INSTANCE_FRAME_ID_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/hash_tables.h" |
+#include <list> |
+ |
+namespace content { |
+class FrameMap; |
+ |
+class BrowsingInstanceFrame { |
Charlie Reis
2011/12/12 22:20:36
Don't forget comments in this class. It's basical
supersat
2011/12/15 19:30:49
Done.
|
+ friend class FrameMap; |
Charlie Reis
2011/12/12 22:20:36
Why not just use setters?
supersat
2011/12/15 19:30:49
The idea was to make sure that people update Conte
|
+ |
+ public: |
Charlie Reis
2011/12/12 22:20:36
Indent is wrong.
supersat
2011/12/15 19:30:49
Done.
supersat
2011/12/15 19:30:49
Done.
|
+ 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); |
+ |
+ private: |
+ int64 id_; |
+ |
+ WebKitFrameIdTuple current_webkit_frame_; |
+ int current_route_id_; |
+ bool is_top_level_; |
+ |
+ std::list<WebKitFrameIdTuple> all_webkit_frames_; |
+}; |
+ |
+} // 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_BROWSING_INSTANCE_FRAME_ID_H_ |