OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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_BROWSING_INSTANCE_FRAME_ID_H_ | |
6 #define CONTENT_BROWSER_BROWSING_INSTANCE_FRAME_ID_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/hash_tables.h" | |
10 #include <list> | |
11 | |
12 namespace content { | |
13 class FrameMap; | |
14 | |
15 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.
| |
16 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
| |
17 | |
18 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.
| |
19 struct WebKitFrameIdTuple { | |
20 WebKitFrameIdTuple(int process_host_id, int64 frame_id); | |
21 bool operator==(const WebKitFrameIdTuple& other) const; | |
22 | |
23 int process_host_id; | |
24 int64 frame_id; | |
25 }; | |
26 | |
27 BrowsingInstanceFrame(int64 id, bool is_top_level); | |
28 virtual ~BrowsingInstanceFrame(); | |
29 | |
30 int64 id() { return id_; } | |
31 | |
32 const WebKitFrameIdTuple current_webkit_frame() const { | |
33 return current_webkit_frame_; | |
34 } | |
35 | |
36 int current_process_host_id() const { | |
37 return current_webkit_frame_.process_host_id; | |
38 } | |
39 | |
40 int current_route_id() const { | |
41 return current_route_id_; | |
42 } | |
43 | |
44 int64 current_frame_id() const { | |
45 return current_webkit_frame_.frame_id; | |
46 } | |
47 | |
48 bool is_top_level() const { | |
49 return is_top_level_; | |
50 } | |
51 | |
52 void UpdateFrame(int new_process_host_id, | |
53 int new_route_id, | |
54 int64 new_frame_id); | |
55 | |
56 private: | |
57 int64 id_; | |
58 | |
59 WebKitFrameIdTuple current_webkit_frame_; | |
60 int current_route_id_; | |
61 bool is_top_level_; | |
62 | |
63 std::list<WebKitFrameIdTuple> all_webkit_frames_; | |
64 }; | |
65 | |
66 } // namespace content | |
67 | |
68 #if defined(COMPILER_GCC) | |
69 namespace __gnu_cxx { | |
70 | |
71 template<> | |
72 struct hash<content::BrowsingInstanceFrame::WebKitFrameIdTuple> { | |
73 std::size_t operator()(const | |
74 content::BrowsingInstanceFrame::WebKitFrameIdTuple& p) const { | |
75 return p.process_host_id * 65537 + p.process_host_id * 257 + p.frame_id; | |
76 } | |
77 }; | |
78 | |
79 } // namespace __gnu_cxx | |
80 #endif | |
81 | |
82 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_FRAME_ID_H_ | |
OLD | NEW |