Chromium Code Reviews| Index: content/browser/frame_map.h |
| diff --git a/content/browser/frame_map.h b/content/browser/frame_map.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4f8b24434778c18b413417db559b6839ae972365 |
| --- /dev/null |
| +++ b/content/browser/frame_map.h |
| @@ -0,0 +1,61 @@ |
| +// 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_FRAME_MAPPER_H_ |
| +#define CONTENT_BROWSER_FRAME_MAPPER_H_ |
| + |
| +#include "base/hash_tables.h" |
| +#include "content/browser/content_frame.h" |
| +#include "content/common/content_export.h" |
| + |
| +class TabContents; |
| + |
| +namespace content { |
| +// This class tracks all ContentFrames, allowing them to be looked up by a |
| +// variety of identifiers. Additionally, it allocates the ContentFrames' |
| +// globally-unique identifiers. |
|
awong
2011/12/21 01:06:38
Should ContentFrames only be created via FrameMap?
|
| +class CONTENT_EXPORT FrameMap { |
|
awong
2011/12/21 01:06:38
Would a better name be ContentFrameMap, ContentFra
|
| + public: |
| + FrameMap(); |
| + virtual ~FrameMap(); |
|
awong
2011/12/21 01:06:38
Why is this virtual?
|
| + |
| + // Returns a new globally-unique ContentFrame id. |
| + int64 AllocateFrameId(); |
|
jam
2011/12/22 20:06:53
why are these global frame ids? since for each Con
|
| + |
| + // Creates and initializes a ContentFrame with a given id. |
| + ContentFrame* InitializeFrame(int64 frame_id, |
|
awong
2011/12/21 01:06:38
Since this returns an object, CreateFrame() is mor
|
| + bool is_top_level, |
| + TabContents& tab_contents, |
| + ContentFrame* opener); |
| + |
| + ContentFrame* FindFrame(int64 id); |
|
awong
2011/12/21 01:06:38
Which id space is |id| from? In particular, how i
|
| + ContentFrame* FindRendererFrame(int render_process_host_id, |
|
awong
2011/12/21 01:06:38
The class comment should explain the various cance
|
| + int64 frame_id); |
| + ContentFrame* FindTopLevelFrame(int process_id, int route_id); |
| + |
| + void UpdateFrame(ContentFrame* frame, |
| + int render_process_host_id, |
| + int route_id, |
| + int64 frame_id); |
| + void AddSwappedOutRendererToFrame(ContentFrame* frame, |
| + int render_process_host_id, |
| + int route_id, |
| + int64 frame_id); |
| + void RemoveFrame(ContentFrame* frame); |
| + |
| + private: |
| + typedef base::hash_map<int64, ContentFrame*> FrameIdMap; |
| + typedef base::hash_map< |
| + ContentFrame::WebKitFrameIdTuple, |
| + ContentFrame*> WebKitFrameIdMap; |
| + |
| + int64 next_frame_id_; |
| + FrameIdMap frame_id_map_; |
| + WebKitFrameIdMap webkit_frame_id_map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FrameMap); |
| +}; |
| + |
| +} // namespace content |
|
awong
2011/12/21 01:06:38
newline before #endif
|
| +#endif // CONTENT_BROWSER_FRAME_MAPPER_H_ |