| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/browser/extension_api_frame_id_map.h" | 5 #include "extensions/browser/extension_api_frame_id_map.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (!web_contents) | 141 if (!web_contents) |
| 142 return nullptr; | 142 return nullptr; |
| 143 | 143 |
| 144 if (frame_id == kInvalidFrameId) | 144 if (frame_id == kInvalidFrameId) |
| 145 return nullptr; | 145 return nullptr; |
| 146 | 146 |
| 147 if (frame_id == kTopFrameId) | 147 if (frame_id == kTopFrameId) |
| 148 return web_contents->GetMainFrame(); | 148 return web_contents->GetMainFrame(); |
| 149 | 149 |
| 150 DCHECK_GE(frame_id, 1); | 150 DCHECK_GE(frame_id, 1); |
| 151 return web_contents->FindFrameByFrameTreeNodeId(frame_id); | 151 return web_contents->UnsafeFindFrameByFrameTreeNodeId(frame_id); |
| 152 } | 152 } |
| 153 | 153 |
| 154 ExtensionApiFrameIdMap::FrameData ExtensionApiFrameIdMap::KeyToValue( | 154 ExtensionApiFrameIdMap::FrameData ExtensionApiFrameIdMap::KeyToValue( |
| 155 const RenderFrameIdKey& key) const { | 155 const RenderFrameIdKey& key) const { |
| 156 content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( | 156 content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( |
| 157 key.render_process_id, key.frame_routing_id); | 157 key.render_process_id, key.frame_routing_id); |
| 158 int tab_id = -1; | 158 int tab_id = -1; |
| 159 int window_id = -1; | 159 int window_id = -1; |
| 160 if (helper_) | 160 if (helper_) |
| 161 helper_->GetTabAndWindowId(rfh, &tab_id, &window_id); | 161 helper_->GetTabAndWindowId(rfh, &tab_id, &window_id); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 356 } |
| 357 | 357 |
| 358 void ExtensionApiFrameIdMap::RemoveFrameData(const RenderFrameIdKey& key) { | 358 void ExtensionApiFrameIdMap::RemoveFrameData(const RenderFrameIdKey& key) { |
| 359 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 359 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 360 | 360 |
| 361 base::AutoLock lock(frame_data_map_lock_); | 361 base::AutoLock lock(frame_data_map_lock_); |
| 362 frame_data_map_.erase(key); | 362 frame_data_map_.erase(key); |
| 363 } | 363 } |
| 364 | 364 |
| 365 } // namespace extensions | 365 } // namespace extensions |
| OLD | NEW |