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

Issue 2505163004: Move const double data out of header file (Closed)

Created:
4 years, 1 month ago by brucedawson
Modified:
4 years, 1 month ago
Reviewers:
fgorski
CC:
chromium-reviews, romax+watch_chromium.org, fgorski+watch_chromium.org, dewittj+watch_chromium.org, petewil+watch_chromium.org, chili+watch_chromium.org, dimich+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move const double data out of header file When non-integral const data is defined in a header file it often ends up being instantiated in multiple translation units. It also ends up in the read/write data segment which means it isn't shared between processes. This change has the following affect on the size of sections in a 32-bit release Windows build: chrome.dll .text: -432 bytes change .rdata: 176 bytes change .data: -128 bytes change .reloc: 228 bytes change Total change: -156 bytes Note that the sections that increase in size are either shareable (.rdata) or discardable (.reloc). I wish I could use "extern constexpr" to ensure that no constructors are run, but C++ does not allow that. inline constexpr is not yet supported, and making the variables a static constexpr member of a class seems like overkill. BUG=630755

Patch Set 1 #

Total comments: 4

Patch Set 2 : Remove duplicate comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -4 lines) Patch
M components/offline_pages/offline_page_storage_manager.h View 1 chunk +4 lines, -4 lines 0 comments Download
M components/offline_pages/offline_page_storage_manager.cc View 1 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (10 generated)
fgorski
https://codereview.chromium.org/2505163004/diff/1/components/offline_pages/offline_page_storage_manager.cc File components/offline_pages/offline_page_storage_manager.cc (right): https://codereview.chromium.org/2505163004/diff/1/components/offline_pages/offline_page_storage_manager.cc#newcode21 components/offline_pages/offline_page_storage_manager.cc:21: // Maximum % of total available storage that will ...
4 years, 1 month ago (2016-11-17 17:10:49 UTC) #6
brucedawson
4 years, 1 month ago (2016-11-17 17:28:57 UTC) #10
https://codereview.chromium.org/2505163004/diff/1/components/offline_pages/of...
File components/offline_pages/offline_page_storage_manager.cc (right):

https://codereview.chromium.org/2505163004/diff/1/components/offline_pages/of...
components/offline_pages/offline_page_storage_manager.cc:21: // Maximum % of
total available storage that will be occupied by offline pages
On 2016/11/17 17:10:49, fgorski wrote:
> drop docs from cc. They will be hard to keep in sync with the .h files, where
> they are needed.

Done.

https://codereview.chromium.org/2505163004/diff/1/components/offline_pages/of...
components/offline_pages/offline_page_storage_manager.cc:23: extern const double
kOfflinePageStorageLimit = 0.3;
On 2016/11/17 17:10:49, fgorski wrote:
> drop the externs from cc. I don't think these are required.

They are actually required. 'const' implies 'static' (which is why the const
objects in the header didn't cause duplicate declaration errors) so extern is
necessary to indicate that they are supposed to be externally visible.

Powered by Google App Engine
This is Rietveld 408576698