diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-13 19:40:08 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-13 19:40:08 +0000 |
commit | a0835ac1850ccabc846ebfcee537b0b0592b8519 (patch) | |
tree | 6f8911806716dd8011cd0c2b3983722fd751c313 /chrome/browser/bookmarks | |
parent | 51748d266bd3558ec1ee508340cdc9d554ea55f5 (diff) | |
download | chromium_src-a0835ac1850ccabc846ebfcee537b0b0592b8519.zip chromium_src-a0835ac1850ccabc846ebfcee537b0b0592b8519.tar.gz chromium_src-a0835ac1850ccabc846ebfcee537b0b0592b8519.tar.bz2 |
FBTF: Move ctors/dtors into cc files.
This cleanup patch isn't as impactful; this only shrinks our .a files by 304k.
This patch also renames chrome/browser/history/download_type.h to download_create_info.h because there are then two download_type.cc files and MSVS will have the .obj from one of those overwrite the other.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/3351005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59264 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_drag_data.cc | 12 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_drag_data.h | 8 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_editor.cc | 20 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_editor.h | 9 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index.cc | 32 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index.h | 30 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.cc | 3 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.h | 2 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_storage.cc | 16 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_storage.h | 9 |
10 files changed, 97 insertions, 44 deletions
diff --git a/chrome/browser/bookmarks/bookmark_drag_data.cc b/chrome/browser/bookmarks/bookmark_drag_data.cc index accc8c6..44ab58e 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data.cc @@ -21,6 +21,9 @@ const char* BookmarkDragData::kClipboardFormatString = "chromium/x-bookmark-entries"; +BookmarkDragData::Element::Element() : is_url(false), id_(0) { +} + BookmarkDragData::Element::Element(const BookmarkNode* node) : is_url(node->is_url()), url(node->GetURL()), @@ -30,6 +33,9 @@ BookmarkDragData::Element::Element(const BookmarkNode* node) children.push_back(Element(node->GetChild(i))); } +BookmarkDragData::Element::~Element() { +} + void BookmarkDragData::Element::WriteToPickle(Pickle* pickle) const { pickle->WriteBool(is_url); pickle->WriteString(url.spec()); @@ -84,6 +90,9 @@ OSExchangeData::CustomFormat BookmarkDragData::GetBookmarkCustomFormat() { } #endif +BookmarkDragData::BookmarkDragData() { +} + BookmarkDragData::BookmarkDragData(const BookmarkNode* node) { elements.push_back(Element(node)); } @@ -93,6 +102,9 @@ BookmarkDragData::BookmarkDragData( ReadFromVector(nodes); } +BookmarkDragData::~BookmarkDragData() { +} + bool BookmarkDragData::ReadFromVector( const std::vector<const BookmarkNode*>& nodes) { Clear(); diff --git a/chrome/browser/bookmarks/bookmark_drag_data.h b/chrome/browser/bookmarks/bookmark_drag_data.h index ca1a10e..d9e52e2f 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data.h +++ b/chrome/browser/bookmarks/bookmark_drag_data.h @@ -44,9 +44,9 @@ class Profile; struct BookmarkDragData { // Element represents a single node. struct Element { + Element(); explicit Element(const BookmarkNode* node); - - Element() : is_url(false), id_(0) {} + ~Element(); // If true, this element represents a URL. bool is_url; @@ -74,7 +74,7 @@ struct BookmarkDragData { int64 id_; }; - BookmarkDragData() { } + BookmarkDragData(); #if defined(TOOLKIT_VIEWS) static OSExchangeData::CustomFormat GetBookmarkCustomFormat(); @@ -84,6 +84,8 @@ struct BookmarkDragData { explicit BookmarkDragData(const BookmarkNode* node); explicit BookmarkDragData(const std::vector<const BookmarkNode*>& nodes); + ~BookmarkDragData(); + // Reads bookmarks from the given vector. bool ReadFromVector(const std::vector<const BookmarkNode*>& nodes); diff --git a/chrome/browser/bookmarks/bookmark_editor.cc b/chrome/browser/bookmarks/bookmark_editor.cc new file mode 100644 index 0000000..2e940fc --- /dev/null +++ b/chrome/browser/bookmarks/bookmark_editor.cc @@ -0,0 +1,20 @@ +// Copyright (c) 2010 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. + +#include "chrome/browser/bookmarks/bookmark_editor.h" + +#include "googleurl/src/gurl.h" + +BookmarkEditor::EditDetails::EditDetails() + : type(NEW_URL), + existing_node(NULL) { +} + +BookmarkEditor::EditDetails::EditDetails(const BookmarkNode* node) + : type(EXISTING_NODE), + existing_node(node) { +} + +BookmarkEditor::EditDetails::~EditDetails() { +} diff --git a/chrome/browser/bookmarks/bookmark_editor.h b/chrome/browser/bookmarks/bookmark_editor.h index 43e2816..63d3ccf 100644 --- a/chrome/browser/bookmarks/bookmark_editor.h +++ b/chrome/browser/bookmarks/bookmark_editor.h @@ -43,12 +43,9 @@ class BookmarkEditor { NEW_FOLDER }; - EditDetails() : type(NEW_URL), existing_node(NULL) {} - - explicit EditDetails(const BookmarkNode* node) - : type(EXISTING_NODE), - existing_node(node) { - } + EditDetails(); + explicit EditDetails(const BookmarkNode* node); + ~EditDetails(); // See description of enum value for details. Type type; diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index 359fc3a..b1c1ab3 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <iterator> +#include <list> #include "app/l10n_util.h" #include "base/string16.h" @@ -15,6 +16,31 @@ #include "chrome/browser/history/query_parser.h" #include "chrome/browser/profile.h" +// Used when finding the set of bookmarks that match a query. Each match +// represents a set of terms (as an interator into the Index) matching the +// query as well as the set of nodes that contain those terms in their titles. +struct BookmarkIndex::Match { + // List of terms matching the query. + std::list<Index::const_iterator> terms; + + // The set of nodes matching the terms. As an optimization this is empty + // when we match only one term, and is filled in when we get more than one + // term. We can do this as when we have only one matching term we know + // the set of matching nodes is terms.front()->second. + // + // Use nodes_begin() and nodes_end() to get an iterator over the set as + // it handles the necessary switching between nodes and terms.front(). + NodeSet nodes; + + // Returns an iterator to the beginning of the matching nodes. See + // description of nodes for why this should be used over nodes.begin(). + NodeSet::const_iterator nodes_begin() const; + + // Returns an iterator to the beginning of the matching nodes. See + // description of nodes for why this should be used over nodes.end(). + NodeSet::const_iterator nodes_end() const; +}; + BookmarkIndex::NodeSet::const_iterator BookmarkIndex::Match::nodes_begin() const { return nodes.empty() ? terms.front()->second.begin() : nodes.begin(); @@ -24,6 +50,12 @@ BookmarkIndex::NodeSet::const_iterator BookmarkIndex::Match::nodes_end() const { return nodes.empty() ? terms.front()->second.end() : nodes.end(); } +BookmarkIndex::BookmarkIndex(Profile* profile) : profile_(profile) { +} + +BookmarkIndex::~BookmarkIndex() { +} + void BookmarkIndex::Add(const BookmarkNode* node) { if (!node->is_url()) return; diff --git a/chrome/browser/bookmarks/bookmark_index.h b/chrome/browser/bookmarks/bookmark_index.h index ac8e207..d6ea15a 100644 --- a/chrome/browser/bookmarks/bookmark_index.h +++ b/chrome/browser/bookmarks/bookmark_index.h @@ -6,7 +6,6 @@ #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_INDEX_H_ #pragma once -#include <list> #include <map> #include <set> #include <vector> @@ -37,7 +36,8 @@ class URLDatabase; class BookmarkIndex { public: - explicit BookmarkIndex(Profile* profile) : profile_(profile) {} + explicit BookmarkIndex(Profile* profile); + ~BookmarkIndex(); // Invoked when a bookmark has been added to the model. void Add(const BookmarkNode* node); @@ -55,31 +55,7 @@ class BookmarkIndex { typedef std::set<const BookmarkNode*> NodeSet; typedef std::map<string16, NodeSet> Index; - // Used when finding the set of bookmarks that match a query. Each match - // represents a set of terms (as an interator into the Index) matching the - // query as well as the set of nodes that contain those terms in their titles. - struct Match { - // List of terms matching the query. - std::list<Index::const_iterator> terms; - - // The set of nodes matching the terms. As an optimization this is empty - // when we match only one term, and is filled in when we get more than one - // term. We can do this as when we have only one matching term we know - // the set of matching nodes is terms.front()->second. - // - // Use nodes_begin() and nodes_end() to get an iterator over the set as - // it handles the necessary switching between nodes and terms.front(). - NodeSet nodes; - - // Returns an iterator to the beginning of the matching nodes. See - // description of nodes for why this should be used over nodes.begin(). - NodeSet::const_iterator nodes_begin() const; - - // Returns an iterator to the beginning of the matching nodes. See - // description of nodes for why this should be used over nodes.end(). - NodeSet::const_iterator nodes_end() const; - }; - + struct Match; typedef std::vector<Match> Matches; // Pairs BookmarkNodes and the number of times the nodes' URLs were typed. diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index 288c4a8..606c205 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -43,6 +43,9 @@ BookmarkNode::BookmarkNode(int64 id, const GURL& url) Initialize(id); } +BookmarkNode::~BookmarkNode() { +} + void BookmarkNode::Initialize(int64 id) { id_ = id; loaded_favicon_ = false; diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index e56c58d..015de94 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -56,7 +56,7 @@ class BookmarkNode : public TreeNode<BookmarkNode> { explicit BookmarkNode(const GURL& url); // Creates a new node with the specified url and id. BookmarkNode(int64 id, const GURL& url); - virtual ~BookmarkNode() {} + virtual ~BookmarkNode(); // Returns the URL. const GURL& GetURL() const { return url_; } diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index 365ba37..6cfe003 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -125,6 +125,22 @@ class BookmarkStorage::LoadTask : public Task { DISALLOW_COPY_AND_ASSIGN(LoadTask); }; +// BookmarkLoadDetails --------------------------------------------------------- + +BookmarkLoadDetails::BookmarkLoadDetails(BookmarkNode* bb_node, + BookmarkNode* other_folder_node, + BookmarkIndex* index, + int64 max_id) + : bb_node_(bb_node), + other_folder_node_(other_folder_node), + index_(index), + max_id_(max_id), + ids_reassigned_(false) { +} + +BookmarkLoadDetails::~BookmarkLoadDetails() { +} + // BookmarkStorage ------------------------------------------------------------- BookmarkStorage::BookmarkStorage(Profile* profile, BookmarkModel* model) diff --git a/chrome/browser/bookmarks/bookmark_storage.h b/chrome/browser/bookmarks/bookmark_storage.h index 6b06957..541b063 100644 --- a/chrome/browser/bookmarks/bookmark_storage.h +++ b/chrome/browser/bookmarks/bookmark_storage.h @@ -31,13 +31,8 @@ class BookmarkLoadDetails { BookmarkLoadDetails(BookmarkNode* bb_node, BookmarkNode* other_folder_node, BookmarkIndex* index, - int64 max_id) - : bb_node_(bb_node), - other_folder_node_(other_folder_node), - index_(index), - max_id_(max_id), - ids_reassigned_(false) { - } + int64 max_id); + ~BookmarkLoadDetails(); BookmarkNode* bb_node() { return bb_node_.get(); } BookmarkNode* release_bb_node() { return bb_node_.release(); } |