OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" | 5 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/data_use_measurement/chrome_data_use_recorder.h" | 10 #include "chrome/browser/data_use_measurement/chrome_data_use_recorder.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 DataUseRecorderEntry old_frame_entry = frame_it->second; | 327 DataUseRecorderEntry old_frame_entry = frame_it->second; |
328 render_frame_data_use_map_.erase(frame_it); | 328 render_frame_data_use_map_.erase(frame_it); |
329 if (old_frame_entry->IsDataUseComplete()) { | 329 if (old_frame_entry->IsDataUseComplete()) { |
330 OnDataUseCompleted(old_frame_entry); | 330 OnDataUseCompleted(old_frame_entry); |
331 data_use_recorders_.erase(old_frame_entry); | 331 data_use_recorders_.erase(old_frame_entry); |
332 } | 332 } |
333 | 333 |
334 // Add a new recorder to the render frame map to replace the deleted one. | 334 // Add a new recorder to the render frame map to replace the deleted one. |
335 DataUseRecorderEntry entry = data_use_recorders_.emplace( | 335 DataUseRecorderEntry entry = data_use_recorders_.emplace( |
336 data_use_recorders_.end()); | 336 data_use_recorders_.end()); |
337 render_frame_data_use_map_.insert(std::make_pair( | 337 std::pair<int, int> frame_key = |
338 RenderFrameHostID(render_process_id, render_frame_id), entry)); | 338 RenderFrameHostID(render_process_id, render_frame_id); |
| 339 entry->set_main_frame_id(frame_key); |
| 340 render_frame_data_use_map_.insert(std::make_pair(frame_key, entry)); |
339 } | 341 } |
340 return; | 342 return; |
341 } | 343 } |
342 | 344 |
343 DataUseRecorderEntry entry = navigation_iter->second; | 345 DataUseRecorderEntry entry = navigation_iter->second; |
344 pending_navigation_data_use_map_.erase(navigation_iter); | 346 pending_navigation_data_use_map_.erase(navigation_iter); |
345 entry->set_main_frame_id( | 347 entry->set_main_frame_id( |
346 RenderFrameHostID(render_process_id, render_frame_id)); | 348 RenderFrameHostID(render_process_id, render_frame_id)); |
347 | 349 |
348 // If the frame has already been deleted then mark this navigation as having | 350 // If the frame has already been deleted then mark this navigation as having |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 data_use_recorders_.end()); | 409 data_use_recorders_.end()); |
408 if (request) { | 410 if (request) { |
409 entry->AddPendingURLRequest(request); | 411 entry->AddPendingURLRequest(request); |
410 request->SetUserData(DataUseRecorderEntryAsUserData::kUserDataKey, | 412 request->SetUserData(DataUseRecorderEntryAsUserData::kUserDataKey, |
411 new DataUseRecorderEntryAsUserData(entry)); | 413 new DataUseRecorderEntryAsUserData(entry)); |
412 } | 414 } |
413 return entry; | 415 return entry; |
414 } | 416 } |
415 | 417 |
416 } // namespace data_use_measurement | 418 } // namespace data_use_measurement |
OLD | NEW |