Closed Bug 1583861 Opened 5 years ago Closed 5 years ago

Files should use GMP_LOG macro from GMPLog.h rather than spinning their own

Categories

(Core :: Audio/Video: GMP, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: bryce, Assigned: bryce)

Details

Attachments

(5 files)

GMPLog.h defines a macro to be used for logging to the GMP log. However, many files still create their own log define -- some of these include GMPLog.h and some do not. I think we should prefer minimizing the number of defines here. Benefits I see:

  • Consistent usage of GMP_LOG makes it clearer that we're logging to the GMP log. With different defines, such as LOG, it's not as immediately obvious what log is being used.
  • Lowers risk of footgunning due to re-defines causing bugs. The motivating factor in creating this bug is that I'm not seeing logs where expected, and I suspect it's because GMPService.cpp defines a LOGD GMP log, but doesn't undef it first if it's already defined.
  • Less boilerplate code at the top of files using the log.
  • A centralised location for the log macro definition makes them easier to change and each file can define its own macro if it really needs it.

This patch changes instances where the GMP MOZ_LOG is used to prefer using
macros from GMPLog.h:

  • Files that don't need their own macros now just directly call
    GMP_LOG_<LEVEL> as required.
  • Files that use their own macros for formatting have had those macro
    definitions changes so that the macros have unique names and are expressed in
    terms of the macros from GMPLog.h.

I've reworked the includes in most of the files I've touched since I was adding
GMPLog.h:

  • Reordered the includes to better match the Google C++ style.
  • Removed includes that are already included from the associated header or
    GMPLog.h. I.e. if Foo.cpp includes Foo.h, and Foo.cpp includes other headers
    already included in Foo.h, these were removed.

I've also made a couple of drive by edits to logs so that they log more than a
couple of words and updated some strings where the incorrect class name was
being logged.

Depends on D47193

I've reworked the includes in most of the files I've touched since I was adding
GMPLog.h:

  • Reordered the includes to better match the Google C++ style.
  • Removed includes that are already included from the associated header or
    GMPLog.h. I.e. if Foo.cpp includes Foo.h, and Foo.cpp includes other headers
    already included in Foo.h, these were removed.

Depends on D47194

Now that we have explicit macros for each GMP_LOG level GMP_LOG and
GMP_LOG_DEBUG are doing the same thing. This patch replaces all instances of
GMP_LOG with GMP_LOG_DEBUG. This has the benefit of all uses of the GMP macros
sharing a consistent naming convention and being explicit about the level
they're logging at.

Depends on D47373

Attachment #9096792 - Attachment description: Bug 1583861 - Replace usages of GMP_LOG with GMP_LOG_DEBUG. r?alwu → Bug 1583861 - Replace usages of GMP_LOG with GMP_LOG_DEBUG and rempve GMP_LOG. r?alwu
Attachment #9096792 - Attachment description: Bug 1583861 - Replace usages of GMP_LOG with GMP_LOG_DEBUG and rempve GMP_LOG. r?alwu → Bug 1583861 - Replace usages of GMP_LOG with GMP_LOG_DEBUG and remove GMP_LOG. r?alwu
Pushed by bvandyk@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ffa5b2008115
Rework GMPLog.h include guard to follow Google C++ style. r=alwu
https://hg.mozilla.org/integration/autoland/rev/d2c33136e60f
Add different log level macros to GMPLog.h r=alwu
https://hg.mozilla.org/integration/autoland/rev/e146d1355850
Use GMPLog.h macros where applicable. r=alwu
https://hg.mozilla.org/integration/autoland/rev/0a0ff7a39921
Tidy includes in files using new logs. r=alwu
https://hg.mozilla.org/integration/autoland/rev/d92b15efc8b4
Replace usages of GMP_LOG with GMP_LOG_DEBUG and remove GMP_LOG. r=alwu
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: