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

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0022.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 SessionTraceFileWriterFactory 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_SESSION_TRACE_FILE_WRITER_H_
  20    :  #define SYZYGY_TRACE_SERVICE_SESSION_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    :  #include "syzygy/trace/service/trace_file_writer.h"
  27    :  
  28  m :  namespace trace {
  29  m :  namespace service {
  30    :  
  31    :  // Forward Declaration.
  32  m :  class Session;
  33  m :  class SessionTraceFileWriterFactory;
  34    :  
  35    :  // This class implements the interface the buffer consumer thread uses to
  36    :  // process incoming buffers.
  37  m :  class SessionTraceFileWriter : public BufferConsumer {
  38  m :   public:
  39    :    // Construct a SessionTraceFileWriter instance.
  40    :    // @param message_loop The message loop on which this writer instance will
  41    :    //     consume buffers. The writer instance does NOT take ownership of the
  42    :    //     message_loop. The message_loop must outlive the writer instance.
  43    :    // @param trace_directory The directory into which this writer instance will
  44    :    //     write the trace file.
  45  m :    SessionTraceFileWriter(base::MessageLoop* message_loop,
  46  m :                           const base::FilePath& trace_directory);
  47    :  
  48    :    // Initialize this trace file writer.
  49    :    // @name BufferConsumer implementation.
  50    :    // @{
  51  m :    virtual bool Open(Session* session) OVERRIDE;
  52  m :    virtual bool Close(Session* session) OVERRIDE;
  53  m :    virtual bool ConsumeBuffer(Buffer* buffer) OVERRIDE;
  54  m :    virtual size_t block_size() const OVERRIDE;
  55    :    // @}
  56    :  
  57  m :   protected:
  58    :    // Commit a trace buffer to disk. This will be called on message_loop_.
  59  m :    void WriteBuffer(Session* session, Buffer* buffer);
  60    :  
  61    :    // The message loop on which this trace file writer will do IO.
  62  m :    base::MessageLoop* const message_loop_;
  63    :  
  64    :    // The name of the trace file. Note that we initialize this to the trace
  65    :    // directory on construction and calculate the final trace file path on
  66    :    // Open().
  67  m :    base::FilePath trace_file_path_;
  68    :  
  69    :    // This is used for committing actual buffers to disk.
  70  m :    TraceFileWriter writer_;
  71    :  
  72  m :   private:
  73  m :    DISALLOW_COPY_AND_ASSIGN(SessionTraceFileWriter);
  74  m :  };
  75    :  
  76  m :  }  // namespace service
  77  m :  }  // namespace trace
  78    :  
  79    :  #endif  // SYZYGY_TRACE_SERVICE_SESSION_TRACE_FILE_WRITER_H_

Coverage information generated Thu Mar 26 16:15:41 2015.