Skip to content
  • vabr's avatar
    //base: Make ScopedTempDir::path() a GetPath() with a DCHECK · 411f4fc6
    vabr authored
    This CL changes the inline ScopedTempDir::path() to an out-of-line
    GetPath() and enhances it with a DCHECK against the directory not
    having been created yet.
    
    FAQ
    
    Q: Why GetPath?
    A: Because of the added DCHECK in the path accessor, which needs
       #include "base/logging.h", there were two alternatives:
        (A) Keep the inline path() and #include "base/logging.h" in the header.
        (B) Change the inline path() to an out-of-line GetPath and implement it
            in the .cc file.
    
       (A) would affect compile-time, (B) affects run-time of the tests. I made no
       measuring, but obtaining the path is usually a one-off step in a test, so an
       unlikely hotspot. Therefore the trade-off seems much better for (B).
    
    Q: Why deprecating path() instead of deleting it?
    A: Due to the big amount of callsites (almost 600 files in the whole codebase),
       this change is rolled out in phases. This CL changes //base. After all of the
       codebase is converted, the deprecated path() will be deleted.
    
    R=danakj@chromium.org
    BUG=640599
    
    Review-Url: https://codereview.chromium.org/2275553005
    Cr-Commit-Position: refs/heads/master@{#417241}
    411f4fc6