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_WORKER_HOST_BROWSING_INSTANCE_FRAME_ID_H_ | |
6 #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.
| |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/hash_tables.h" | |
10 #include <list> | |
11 | |
12 namespace content { | |
13 class FrameMapper; | |
14 | |
15 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.
| |
16 friend class FrameMapper; | |
17 | |
18 public: | |
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 // TODO(supersat): Not currently used. | |
57 BrowsingInstanceFrame* FindById(int64 id); | |
58 | |
59 private: | |
60 int64 id_; | |
61 | |
62 BrowsingInstanceFrame* parent_; | |
63 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
| |
64 | |
65 WebKitFrameIdTuple current_webkit_frame_; | |
66 int current_route_id_; | |
67 bool is_top_level_; | |
68 }; | |
69 | |
70 } // namespace content | |
71 | |
72 #if defined(COMPILER_GCC) | |
73 namespace __gnu_cxx { | |
74 | |
75 template<> | |
76 struct hash<content::BrowsingInstanceFrame::WebKitFrameIdTuple> { | |
77 std::size_t operator()(const | |
78 content::BrowsingInstanceFrame::WebKitFrameIdTuple& p) const { | |
79 return p.process_host_id * 65537 + p.process_host_id * 257 + p.frame_id; | |
80 } | |
81 }; | |
82 | |
83 } // namespace __gnu_cxx | |
84 #endif | |
85 | |
86 #endif // CONTENT_BROWSER_WORKER_HOST_BROWSING_INSTANCE_FRAME_ID_H_ | |
OLD | NEW |