Coverage for /Syzygy/trace/service/trace_file_writer.h

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

Line-by-line coverage:

   1    :  // Copyright 2012 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    :  // This file declares the TraceFileWriterFactory class, which provides a
  16    :  // factory implementation for the default buffer consumer used by the call
  17    :  // trace service.
  18    :  
  19    :  #ifndef SYZYGY_TRACE_SERVICE_TRACE_FILE_WRITER_H_
  20    :  #define SYZYGY_TRACE_SERVICE_TRACE_FILE_WRITER_H_
  21    :  
  22    :  #include "base/files/file_path.h"
  23    :  #include "base/threading/thread.h"
  24    :  #include "base/win/scoped_handle.h"
  25    :  #include "syzygy/trace/service/buffer_consumer.h"
  26    :  
  27  m :  namespace trace {
  28  m :  namespace service {
  29    :  
  30    :  // Forward Declaration.
  31  m :  class Session;
  32  m :  class TraceFileWriterFactory;
  33    :  
  34    :  // This class implements the interface the buffer consumer thread uses to
  35    :  // process incoming buffers.
  36  m :  class TraceFileWriter : public BufferConsumer {
  37  m :   public:
  38    :    // Construct a TraceFileWriter instance.
  39    :    // @param message_loop The message loop on which this writer instance will
  40    :    //     consume buffers. The writer instance does NOT take ownership of the
  41    :    //     message_loop. The message_loop must outlive the writer instance.
  42    :    // @param trace_directory The directory into which this writer instance will
  43    :    //     write the trace file.
  44  m :    TraceFileWriter(base::MessageLoop* message_loop,
  45  m :                    const base::FilePath& trace_directory);
  46    :  
  47    :    // Initialize this trace file writer.
  48    :    // @name BufferConsumer implementation.
  49    :    // @{
  50  m :    bool Open(Session* session) OVERRIDE;
  51  m :    bool Close(Session* session) OVERRIDE;
  52  m :    virtual bool ConsumeBuffer(Buffer* buffer) OVERRIDE;
  53  m :    virtual size_t block_size() const OVERRIDE;
  54    :    // @}
  55    :  
  56  m :   protected:
  57    :    // Commit a trace buffer to disk. This will be called on message_loop_.
  58  m :    void WriteBuffer(Session* session, Buffer* buffer);
  59    :  
  60    :    // The message loop on which this trace file writer will do IO.
  61  m :    base::MessageLoop* const message_loop_;
  62    :  
  63    :    // The name of the trace file. Note that we initialize this to the trace
  64    :    // directory on construction and calculate the final trace file path on
  65    :    // Open().
  66  m :    base::FilePath trace_file_path_;
  67    :  
  68    :    // The handle to the trace file to which buffers are committed.
  69  m :    base::win::ScopedHandle trace_file_handle_;
  70    :  
  71    :    // The block size used when writing to disk. This corresponds to
  72    :    // the physical sector size of the disk.
  73  m :    size_t block_size_;
  74    :  
  75  m :   private:
  76  m :    DISALLOW_COPY_AND_ASSIGN(TraceFileWriter);
  77  m :  };
  78    :  
  79  m :  }  // namespace service
  80  m :  }  // namespace trace
  81    :  
  82    :  #endif  // SYZYGY_TRACE_SERVICE_TRACE_FILE_WRITER_H_

Coverage information generated Thu Jul 04 09:34:53 2013.