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

Issue 831903002: Get rid of fifteen copies of m_sTimeMap and their initializers. (Closed)

Created:
5 years, 11 months ago by brucedawson
Modified:
5 years, 11 months ago
Reviewers:
Tom Sepez
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Get rid of fifteen copies of m_sTimeMap and their initializers. m_sTimeMap is a global variable with a constructor and destructor, which is not allowed. This change moves it to a function with a static pointer so that it is constructed on demand and then leaked, thus avoiding having startup and shutdown code. This also fixes a worrisome bug caused by having m_sTimeMap defined in a header file. Because m_sTimeMap was defined (and marked as static) in a header file there were fifteen separate copies of it, one for each source file which included the header file. This could easily lead to bugs because a timer that was added from one source file would be invisible to other source files. Each instance of m_sTimeMap added four entries to the dump-static-initializers.py report, for a total of sixty, so this fix significantly cleans up that report. BUG=441899 R=tsepez@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/a975cfae4719986e5ea0ff06a45b91e1cdd042b3

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -4 lines) Patch
M fpdfsdk/include/javascript/JS_Object.h View 4 chunks +4 lines, -4 lines 0 comments Download
M fpdfsdk/src/javascript/JS_Object.cpp View 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
brucedawson
I think this fix is correct according to the Google style guide and Chrome examples. ...
5 years, 11 months ago (2014-12-31 01:17:44 UTC) #2
Tom Sepez
A quick search shows some precedent for using this style. LGTM
5 years, 11 months ago (2015-01-05 20:27:09 UTC) #3
brucedawson
5 years, 11 months ago (2015-01-05 21:21:51 UTC) #4
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
a975cfae4719986e5ea0ff06a45b91e1cdd042b3 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698