Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: headless/lib/browser/headless_browser_context_impl.h

Issue 2830753004: Pipe the devTools FrameId from blink into the browser for headless (Closed)
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_browser_context_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_browser_context_impl.h
diff --git a/headless/lib/browser/headless_browser_context_impl.h b/headless/lib/browser/headless_browser_context_impl.h
index 688244917936123d7ac9e369501f85f4135758bb..e6a77f107c897a461fd13243aca87cdb89190c5e 100644
--- a/headless/lib/browser/headless_browser_context_impl.h
+++ b/headless/lib/browser/headless_browser_context_impl.h
@@ -45,6 +45,12 @@ class HeadlessBrowserContextImpl : public HeadlessBrowserContext,
void Close() override;
const std::string& Id() const override;
+ void SetFrameTreeNodeId(int render_process_id,
+ int render_frame_routing_id,
+ int frame_tree_node_id);
+
+ void RemoveFrameTreeNode(int render_process_id, int render_frame_routing_id);
+
// BrowserContext implementation:
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
const base::FilePath& partition_path) override;
@@ -81,6 +87,10 @@ class HeadlessBrowserContextImpl : public HeadlessBrowserContext,
HeadlessBrowserImpl* browser() const;
const HeadlessBrowserContextOptions* options() const;
+ // Returns the FrameTreeNode id for the corresponding RenderFrameHost or -1
+ // if it can't be found. Can be called on any thread.
+ int GetFrameTreeNodeId(int render_process_id, int render_frame_id) const;
+
private:
HeadlessBrowserContextImpl(
HeadlessBrowserImpl* browser,
@@ -98,6 +108,13 @@ class HeadlessBrowserContextImpl : public HeadlessBrowserContext,
std::unordered_map<std::string, std::unique_ptr<HeadlessWebContents>>
web_contents_map_;
+ // Guards |frame_tree_node_map_| from being concurrently written on the UI
+ // thread and read on the IO thread.
+ // TODO(alexclarke): Remove if we can add FrameTreeNode ID to
+ // URLRequestUserData. See https://crbug.com/715541
+ mutable base::Lock frame_tree_node_map_lock_;
+ std::map<std::pair<int, int>, int> frame_tree_node_map_;
+
std::unique_ptr<content::PermissionManager> permission_manager_;
std::string id_;
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_browser_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698