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

Side by Side Diff: components/sessions/core/serialized_navigation_entry.cc

Issue 2451583002: Add MDP for TabRestorer.
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/sessions/core/serialized_navigation_entry.h" 5 #include "components/sessions/core/serialized_navigation_entry.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/trace_event/estimate_memory_usage.h"
11 #include "components/sessions/core/serialized_navigation_driver.h" 12 #include "components/sessions/core/serialized_navigation_driver.h"
12 #include "components/sync/base/time.h" 13 #include "components/sync/base/time.h"
13 #include "components/sync/protocol/session_specifics.pb.h" 14 #include "components/sync/protocol/session_specifics.pb.h"
14 15
16 // TODO(dskiba): move somemhere
17 size_t EstimateMemoryUsage(const GURL& url) {
18 using base::trace_event::EstimateMemoryUsage;
19 return EstimateMemoryUsage(url.possibly_invalid_spec()) +
20 (url.inner_url() ? EstimateMemoryUsage(*url.inner_url()) : 0);
21 }
22
15 namespace sessions { 23 namespace sessions {
16 24
17 // TODO(treib): Remove, not needed anymore. crbug.com/627747 25 // TODO(treib): Remove, not needed anymore. crbug.com/627747
18 const char kSearchTermsKey[] = "search_terms"; 26 const char kSearchTermsKey[] = "search_terms";
19 27
20 SerializedNavigationEntry::SerializedNavigationEntry() 28 SerializedNavigationEntry::SerializedNavigationEntry()
21 : index_(-1), 29 : index_(-1),
22 unique_id_(0), 30 unique_id_(0),
23 transition_type_(ui::PAGE_TRANSITION_TYPED), 31 transition_type_(ui::PAGE_TRANSITION_TYPED),
24 has_post_data_(false), 32 has_post_data_(false),
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 sync_data.set_last_navigation_redirect_url( 501 sync_data.set_last_navigation_redirect_url(
494 redirect_chain_[last_entry].spec()); 502 redirect_chain_[last_entry].spec());
495 } 503 }
496 } 504 }
497 505
498 sync_data.set_is_restored(is_restored_); 506 sync_data.set_is_restored(is_restored_);
499 507
500 return sync_data; 508 return sync_data;
501 } 509 }
502 510
511 size_t SerializedNavigationEntry::EstimateMemoryUsage() const {
512 using base::trace_event::EstimateMemoryUsage;
513 return
514 EstimateMemoryUsage(referrer_url_) +
515 EstimateMemoryUsage(virtual_url_) +
516 EstimateMemoryUsage(title_) +
517 EstimateMemoryUsage(encoded_page_state_) +
518 EstimateMemoryUsage(original_request_url_) +
519 EstimateMemoryUsage(search_terms_) +
520 EstimateMemoryUsage(favicon_url_) +
521 EstimateMemoryUsage(redirect_chain_) +
522 EstimateMemoryUsage(content_pack_categories_) +
523 EstimateMemoryUsage(extended_info_map_);
524 }
525
503 } // namespace sessions 526 } // namespace sessions
OLDNEW
« no previous file with comments | « components/sessions/core/serialized_navigation_entry.h ('k') | components/sessions/core/tab_restore_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698