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

Side by Side Diff: chrome/browser/webdata/web_apps_table.cc

Issue 13993005: Switch to narrowest scope for a static, per suggestion in a review on another file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/webdata/web_apps_table.h" 5 #include "chrome/browser/webdata/web_apps_table.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/history/history_database.h" 8 #include "chrome/browser/history/history_database.h"
9 #include "components/webdata/common/web_database.h" 9 #include "components/webdata/common/web_database.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "sql/statement.h" 11 #include "sql/statement.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/gfx/codec/png_codec.h" 13 #include "ui/gfx/codec/png_codec.h"
14 14
15 namespace { 15 namespace {
16 16
17 int table_key = 0;
18
19 WebDatabaseTable::TypeKey GetKey() { 17 WebDatabaseTable::TypeKey GetKey() {
18 // We just need a unique constant. Use the address of a static that
19 // COMDAT folding won't touch in an optimizing linker.
20 static int table_key = 0;
20 return reinterpret_cast<void*>(&table_key); 21 return reinterpret_cast<void*>(&table_key);
21 } 22 }
22 23
23 } // namespace 24 } // namespace
24 25
25 WebAppsTable* WebAppsTable::FromWebDatabase(WebDatabase* db) { 26 WebAppsTable* WebAppsTable::FromWebDatabase(WebDatabase* db) {
26 return static_cast<WebAppsTable*>(db->GetTable(GetKey())); 27 return static_cast<WebAppsTable*>(db->GetTable(GetKey()));
27 } 28 }
28 29
29 WebDatabaseTable::TypeKey WebAppsTable::GetTypeKey() const { 30 WebDatabaseTable::TypeKey WebAppsTable::GetTypeKey() const {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 140
140 if (!delete_s.Run()) 141 if (!delete_s.Run())
141 return false; 142 return false;
142 143
143 sql::Statement delete_s2(db_->GetUniqueStatement( 144 sql::Statement delete_s2(db_->GetUniqueStatement(
144 "DELETE FROM web_apps WHERE url = ?")); 145 "DELETE FROM web_apps WHERE url = ?"));
145 delete_s2.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url)); 146 delete_s2.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url));
146 147
147 return delete_s2.Run(); 148 return delete_s2.Run();
148 } 149 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/token_service_table.cc ('k') | chrome/browser/webdata/web_intents_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698