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

Issue 2953473002: Use leveldb_env::OpenDB() to open leveldb databases. (Closed)

Created:
3 years, 6 months ago by DmitrySkiba
Modified:
3 years, 5 months ago
CC:
awdf+watch_chromium.org, blink-worker-reviews_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, cmumford, darin-cc_chromium.org, extensions-reviews_chromium.org, fukino+watch_chromium.org, horo+watch_chromium.org, jam, johnme+watch_chromium.org, jsbell+idb_chromium.org, jsbell+serviceworker_chromium.org, kinuko+serviceworker, kinuko+watch, kinuko+fileapi, michaeln, mlamouri+watch-notifications_chromium.org, nhiroki, oka+watch_chromium.org, Peter Beverloo, serviceworker-reviews, shimazu+serviceworker_chromium.org, sync-reviews_chromium.org, tbansal+watch-data-reduction-proxy_chromium.org, tzik, yamaguchi+watch_chromium.org, zea+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Use leveldb_env::OpenDB() to open leveldb databases. This CL rewrites usages of leveldb::DB::Open() to leveldb_env::OpenDB(), exposing memory usage of leveldb databases to Chrome's tracing. The only API difference of leveldb_env::OpenDB() is related to how it returns its result: 1. It returns (via output parameter) std::unique_ptr<leveldb::DB>, while leveldb::DB::Open() returns a raw leveldb::DB pointer. 2. It doesn't modify output parameter on failure, while leveldb::DB::Open() returns (writes) nullptr. Both of these changes are consistent with Chrome's guidelines. Under the hood leveldb_env::OpenDB() uses leveldb_env::DBTracker to open and expose databases to Chrome's tracing. See crrev.com/2855953002 for details. Finally, this CL does two more things: 1. Adds a presubmit check to enforce usage of leveldb_env::OpenDB(). 2. Fixes existing memory dump providers that already dump some leveldb databases to properly attribute their memory usage. Further work on those MDPs is tracked by crbug.com/735269. BUG=711518 Review-Url: https://codereview.chromium.org/2953473002 Cr-Commit-Position: refs/heads/master@{#488099} Committed: https://chromium.googlesource.com/chromium/src/+/1474c2bfd6194e04828472b5b0bda9b5a50912c8

Patch Set 1 #

Patch Set 2 : Add presubmit check #

Patch Set 3 : Use leveldb_env::OpenDB #

Patch Set 4 : Remove bogus comments #

Patch Set 5 : Use OpenDB in unittests; add allocation edges #

Total comments: 8

Patch Set 6 : Address comments #

Patch Set 7 : Rebase #

Patch Set 8 : Fix bot redness #

Patch Set 9 : Don't dump in background mode #

Total comments: 5

Patch Set 10 : Rebase #

Patch Set 11 : Rebase; address comments #

Total comments: 6

Patch Set 12 : Rebase; add comments to CHECK() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+158 lines, -174 lines) Patch
M PRESUBMIT.py View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/browser/android/history_report/delta_file_backend_leveldb.cc View 1 2 3 4 5 6 7 2 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/android/history_report/usage_reports_buffer_backend.cc View 1 2 3 1 chunk +3 lines, -5 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc View 1 2 3 4 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/metadata_database.cc View 1 2 1 chunk +3 lines, -4 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk_unittest.cc View 1 2 3 4 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/metadata_database_index_unittest.cc View 1 2 3 4 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc View 1 2 3 4 2 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc View 1 2 3 4 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/register_app_task_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/sync_file_system/local/local_file_change_tracker.cc View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M components/data_reduction_proxy/core/browser/data_store_impl.cc View 1 2 2 chunks +3 lines, -5 lines 0 comments Download
M components/drive/resource_metadata_storage.cc View 1 2 5 chunks +11 lines, -14 lines 0 comments Download
M components/leveldb/leveldb_database_impl.cc View 1 2 3 4 5 6 2 chunks +5 lines, -5 lines 0 comments Download
M components/leveldb/leveldb_service_impl.cc View 1 2 3 4 5 6 2 chunks +10 lines, -11 lines 0 comments Download
M components/leveldb_proto/leveldb_database.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -12 lines 0 comments Download
M components/leveldb_proto/proto_database_impl_unittest.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -9 lines 0 comments Download
M components/sync/engine/attachments/on_disk_attachment_store.cc View 1 2 2 chunks +2 lines, -5 lines 0 comments Download
M components/sync/engine/attachments/on_disk_attachment_store_unittest.cc View 1 2 3 4 2 chunks +4 lines, -3 lines 0 comments Download
M components/sync/model_impl/model_type_store_backend.cc View 1 2 3 4 5 2 chunks +1 line, -6 lines 0 comments Download
M content/browser/dom_storage/local_storage_context_mojo_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -3 lines 0 comments Download
M content/browser/dom_storage/session_storage_database.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M content/browser/dom_storage/session_storage_database.cc View 1 2 3 4 5 chunks +9 lines, -14 lines 0 comments Download
M content/browser/indexed_db/leveldb/leveldb_database.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +5 lines, -8 lines 0 comments Download
M content/browser/notifications/notification_database.cc View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M content/browser/service_worker/service_worker_database.cc View 1 2 3 4 5 6 1 chunk +1 line, -4 lines 0 comments Download
M extensions/browser/value_store/lazy_leveldb.cc View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -12 lines 0 comments Download
M extensions/browser/value_store/leveldb_value_store.cc View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -6 lines 0 comments Download
M google_apis/gcm/engine/gcm_store_impl.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +2 lines, -4 lines 0 comments Download
M storage/browser/fileapi/sandbox_directory_database.cc View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M storage/browser/fileapi/sandbox_origin_database.cc View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M third_party/leveldatabase/env_chromium.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +12 lines, -1 line 0 comments Download
M third_party/leveldatabase/env_chromium.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +15 lines, -2 lines 0 comments Download

Messages

Total messages: 53 (25 generated)
DmitrySkiba
PTAL I decided that it's not worth adding any sort of checks to DBTracker::GetMemoryDumpName() because: ...
3 years, 5 months ago (2017-07-06 01:01:53 UTC) #2
DmitrySkiba
PTAL I decided that it's not worth adding any sort of checks to DBTracker::GetMemoryDumpName() because: ...
3 years, 5 months ago (2017-07-06 01:02:41 UTC) #4
pwnall
On 2017/07/06 01:02:41, DmitrySkiba wrote: > PTAL > > I decided that it's not worth ...
3 years, 5 months ago (2017-07-06 14:32:07 UTC) #9
pwnall
https://codereview.chromium.org/2953473002/diff/80001/chrome/browser/sync_file_system/drive_backend/metadata_database.cc File chrome/browser/sync_file_system/drive_backend/metadata_database.cc (right): https://codereview.chromium.org/2953473002/diff/80001/chrome/browser/sync_file_system/drive_backend/metadata_database.cc#newcode227 chrome/browser/sync_file_system/drive_backend/metadata_database.cc:227: leveldb_env::OpenDB(options, path.AsUTF8Unsafe(), &db); I expect you'll need to #include ...
3 years, 5 months ago (2017-07-06 14:32:25 UTC) #10
DmitrySkiba
Also added note to GetMemoryDumpName() that db should be tracked, and renamed the argument to ...
3 years, 5 months ago (2017-07-06 23:15:13 UTC) #11
pwnall
LGTM w/ nits. https://codereview.chromium.org/2953473002/diff/80001/components/sync/model_impl/model_type_store_backend.cc File components/sync/model_impl/model_type_store_backend.cc (right): https://codereview.chromium.org/2953473002/diff/80001/components/sync/model_impl/model_type_store_backend.cc#newcode189 components/sync/model_impl/model_type_store_backend.cc:189: DCHECK(status.ok()); On 2017/07/06 23:15:13, DmitrySkiba wrote: ...
3 years, 5 months ago (2017-07-07 22:30:30 UTC) #24
DmitrySkiba
https://codereview.chromium.org/2953473002/diff/80001/components/sync/model_impl/model_type_store_backend.cc File components/sync/model_impl/model_type_store_backend.cc (right): https://codereview.chromium.org/2953473002/diff/80001/components/sync/model_impl/model_type_store_backend.cc#newcode189 components/sync/model_impl/model_type_store_backend.cc:189: DCHECK(status.ok()); On 2017/07/07 22:30:29, pwnall wrote: > On 2017/07/06 ...
3 years, 5 months ago (2017-07-17 22:09:25 UTC) #25
DmitrySkiba
Folks, welcome to the party! Please review responsibly! See CL description for info. Here are ...
3 years, 5 months ago (2017-07-17 22:56:05 UTC) #27
Devlin
extensions/browser/value_store* lgtm. Thanks for the detailed migration description!
3 years, 5 months ago (2017-07-17 23:06:19 UTC) #28
pavely
components/sync/* lgtm
3 years, 5 months ago (2017-07-18 00:16:34 UTC) #29
michaeln
dom_storage lgtm https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc File third_party/leveldatabase/env_chromium.cc (right): https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc#newcode1253 third_party/leveldatabase/env_chromium.cc:1253: static DBTracker* instance = new DBTracker(); is ...
3 years, 5 months ago (2017-07-18 00:18:49 UTC) #30
DmitrySkiba
On 2017/07/18 00:18:49, michaeln wrote: > dom_storage lgtm > > https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc > File third_party/leveldatabase/env_chromium.cc (right): ...
3 years, 5 months ago (2017-07-18 00:22:40 UTC) #31
michaeln
https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc File third_party/leveldatabase/env_chromium.cc (right): https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc#newcode1253 third_party/leveldatabase/env_chromium.cc:1253: static DBTracker* instance = new DBTracker(); On 2017/07/18 00:18:49, ...
3 years, 5 months ago (2017-07-18 00:47:22 UTC) #32
jochen (gone - plz use gerrit)
lgtm
3 years, 5 months ago (2017-07-18 07:09:11 UTC) #33
hashimoto
components/drive/resource_metadata_storage.cc lgtm
3 years, 5 months ago (2017-07-18 08:11:52 UTC) #34
Marijn Kruisselbrink
lgtm https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc File third_party/leveldatabase/env_chromium.cc (right): https://codereview.chromium.org/2953473002/diff/200001/third_party/leveldatabase/env_chromium.cc#newcode1267 third_party/leveldatabase/env_chromium.cc:1267: CHECK((status.ok() && db) || (!status.ok() && !db)); nit: ...
3 years, 5 months ago (2017-07-18 17:12:25 UTC) #35
megjablon
lgtm
3 years, 5 months ago (2017-07-18 18:22:38 UTC) #36
nyquist
chrome/browser/android/history_report lgtm https://codereview.chromium.org/2953473002/diff/200001/components/leveldb_proto/leveldb_database.cc File components/leveldb_proto/leveldb_database.cc (left): https://codereview.chromium.org/2953473002/diff/200001/components/leveldb_proto/leveldb_database.cc#oldcode75 components/leveldb_proto/leveldb_database.cc:75: CHECK(db); This CHECK seems to be kept ...
3 years, 5 months ago (2017-07-18 18:48:16 UTC) #37
DmitrySkiba
https://codereview.chromium.org/2953473002/diff/200001/components/leveldb_proto/leveldb_database.cc File components/leveldb_proto/leveldb_database.cc (left): https://codereview.chromium.org/2953473002/diff/200001/components/leveldb_proto/leveldb_database.cc#oldcode75 components/leveldb_proto/leveldb_database.cc:75: CHECK(db); On 2017/07/18 18:48:16, nyquist wrote: > This CHECK ...
3 years, 5 months ago (2017-07-18 19:01:05 UTC) #38
tzik
lgtm
3 years, 5 months ago (2017-07-19 04:49:43 UTC) #39
jsbell
lgtm
3 years, 5 months ago (2017-07-19 16:59:30 UTC) #40
Peter Beverloo
lgtm
3 years, 5 months ago (2017-07-19 17:04:28 UTC) #41
Mathieu
lgtm
3 years, 5 months ago (2017-07-19 17:05:34 UTC) #42
Nicolas Zea
gcm lgtm
3 years, 5 months ago (2017-07-19 18:02:41 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2953473002/220001
3 years, 5 months ago (2017-07-19 20:46:16 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/504591)
3 years, 5 months ago (2017-07-19 21:47:21 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2953473002/220001
3 years, 5 months ago (2017-07-19 23:18:09 UTC) #50
commit-bot: I haz the power
3 years, 5 months ago (2017-07-20 02:19:44 UTC) #53
Message was sent while issue was closed.
Committed patchset #12 (id:220001) as
https://chromium.googlesource.com/chromium/src/+/1474c2bfd6194e04828472b5b0bd...

Powered by Google App Engine
This is Rietveld 408576698