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 <memory>
  27    :  
  28    :  #include "base/logging.h"
  29    :  #include "base/files/file_path.h"
  30    :  #include "syzygy/ar/ar_common.h"
  31    :  #include "syzygy/instrument/instrumenter.h"
  32    :  
  33  m :  namespace instrument {
  34  m :  namespace instrumenters {
  35    :  
  36  m :  class ArchiveInstrumenter : public InstrumenterInterface {
  37  m :   public:
  38  m :    typedef InstrumenterInterface* (*InstrumenterFactoryFunction)();
  39    :  
  40    :    // Constructor.
  41  m :    ArchiveInstrumenter();
  42  m :    explicit ArchiveInstrumenter(InstrumenterFactoryFunction factory);
  43    :  
  44    :    // @name Accessors.
  45    :    // @{
  46    :    // @returns the factory function being used by this instrumenter
  47    :    //     adapter.
  48  m :    InstrumenterFactoryFunction factory() const { return factory_; }
  49    :    // @}
  50    :  
  51    :    // @name Mutators.
  52    :    // @{
  53  m :    void set_factory(InstrumenterFactoryFunction factory) {
  54  m :      DCHECK_NE(reinterpret_cast<InstrumenterFactoryFunction>(NULL), factory);
  55  m :      factory_ = factory;
  56  m :    }
  57    :    // @}
  58    :  
  59    :    // @name InstrumenterInterface implementation.
  60  m :    virtual bool ParseCommandLine(const base::CommandLine* command_line) override;
  61  m :    virtual bool Instrument() override;
  62    :    // @}
  63    :  
  64  m :   private:
  65    :    // Determines if we're processing an archive file or not.
  66  m :    bool ProcessingArchive() const;
  67    :    // Passes through to the underlying instrumenter.
  68  m :    bool InstrumentPassthrough();
  69    :    // Instruments an archive.
  70  m :    bool InstrumentArchive();
  71    :    // Callback for the ArTransform object. This is invoked for each file in an
  72    :    // archive.
  73  m :    bool InstrumentFile(const base::FilePath& input_path,
  74  m :                        const base::FilePath& output_path,
  75  m :                        ar::ParsedArFileHeader* header,
  76  m :                        bool* remove);
  77    :  
  78    :    // The factory function that is used to produce instrumenter instances.
  79  m :    InstrumenterFactoryFunction factory_;
  80    :  
  81    :    // A copy of the command-line that we originally parsed.
  82  m :    std::unique_ptr<base::CommandLine> command_line_;
  83    :  
  84    :    // Bits of the command-line that we've parsed.
  85  m :    base::FilePath input_image_;
  86  m :    base::FilePath output_image_;
  87  m :    bool overwrite_;
  88    :  
  89  m :    DISALLOW_COPY_AND_ASSIGN(ArchiveInstrumenter);
  90  m :  };
  91    :  
  92  m :  }  // namespace instrumenters
  93  m :  }  // namespace instrument
  94    :  
  95    :  #endif  // SYZYGY_INSTRUMENT_INSTRUMENTERS_ARCHIVE_INSTRUMENTER_H_

Coverage information generated Fri Jul 29 11:00:21 2016.