Coverage for /Syzygy/instrument/instrumenters/archive_instrumenter.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0031.C++source

Line-by-line coverage:

   1    :  // Copyright 2014 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // Instrumentation adapter that adds archive support to any existing
  16    :  // instrumenter. Takes care of instantiating a new instance of the
  17    :  // underlying instrumenter for each file in the archive. When not processing
  18    :  // an archive simply passes through the original instrumenter.
  19    :  //
  20    :  // This presumes that the underlying instrumenter uses --input-image and
  21    :  // --output-image for configuring which files are operated on.
  22    :  
  23    :  #ifndef SYZYGY_INSTRUMENT_INSTRUMENTERS_ARCHIVE_INSTRUMENTER_H_
  24    :  #define SYZYGY_INSTRUMENT_INSTRUMENTERS_ARCHIVE_INSTRUMENTER_H_
  25    :  
  26    :  #include "base/logging.h"
  27    :  #include "base/files/file_path.h"
  28    :  #include "base/memory/scoped_ptr.h"
  29    :  #include "syzygy/ar/ar_common.h"
  30    :  #include "syzygy/instrument/instrumenter.h"
  31    :  
  32  m :  namespace instrument {
  33  m :  namespace instrumenters {
  34    :  
  35  m :  class ArchiveInstrumenter : public InstrumenterInterface {
  36  m :   public:
  37  m :    typedef InstrumenterInterface* (*InstrumenterFactoryFunction)();
  38    :  
  39    :    // Constructor.
  40  m :    ArchiveInstrumenter();
  41  m :    explicit ArchiveInstrumenter(InstrumenterFactoryFunction factory);
  42    :  
  43    :    // @name Accessors.
  44    :    // @{
  45    :    // @returns the factory function being used by this instrumenter
  46    :    //     adapter.
  47  m :    InstrumenterFactoryFunction factory() const { return factory_; }
  48    :    // @}
  49    :  
  50    :    // @name Mutators.
  51    :    // @{
  52  m :    void set_factory(InstrumenterFactoryFunction factory) {
  53  m :      DCHECK_NE(reinterpret_cast<InstrumenterFactoryFunction>(NULL), factory);
  54  m :      factory_ = factory;
  55  m :    }
  56    :    // @}
  57    :  
  58    :    // @name InstrumenterInterface implementation.
  59  m :    virtual bool ParseCommandLine(const base::CommandLine* command_line) override;
  60  m :    virtual bool Instrument() override;
  61    :    // @}
  62    :  
  63  m :   private:
  64    :    // Determines if we're processing an archive file or not.
  65  m :    bool ProcessingArchive() const;
  66    :    // Passes through to the underlying instrumenter.
  67  m :    bool InstrumentPassthrough();
  68    :    // Instruments an archive.
  69  m :    bool InstrumentArchive();
  70    :    // Callback for the ArTransform object. This is invoked for each file in an
  71    :    // archive.
  72  m :    bool InstrumentFile(const base::FilePath& input_path,
  73  m :                        const base::FilePath& output_path,
  74  m :                        ar::ParsedArFileHeader* header,
  75  m :                        bool* remove);
  76    :  
  77    :    // The factory function that is used to produce instrumenter instances.
  78  m :    InstrumenterFactoryFunction factory_;
  79    :  
  80    :    // A copy of the command-line that we originally parsed.
  81  m :    scoped_ptr<base::CommandLine> command_line_;
  82    :  
  83    :    // Bits of the command-line that we've parsed.
  84  m :    base::FilePath input_image_;
  85  m :    base::FilePath output_image_;
  86  m :    bool overwrite_;
  87    :  
  88  m :    DISALLOW_COPY_AND_ASSIGN(ArchiveInstrumenter);
  89  m :  };
  90    :  
  91  m :  }  // namespace instrumenters
  92  m :  }  // namespace instrument
  93    :  
  94    :  #endif  // SYZYGY_INSTRUMENT_INSTRUMENTERS_ARCHIVE_INSTRUMENTER_H_

Coverage information generated Thu Jan 14 17:40:38 2016.