LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrPendingProgramElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 14 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2014 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : 
       8             : #ifndef GrPendingProgramElement_DEFINED
       9             : #define GrPendingProgramElement_DEFINED
      10             : 
      11             : #include "SkRefCnt.h"
      12             : #include "GrTypes.h"
      13             : 
      14             : /**
      15             :  * Helper for owning a pending execution on a GrProgramElement. Using this rather than ref allows
      16             :  * resources that are owned by the program element to be correctly tracked as having pending reads
      17             :  * and writes rather than refs.
      18             :  */
      19             : template <typename T> class GrPendingProgramElement : SkNoncopyable {
      20             : public:
      21           0 :     GrPendingProgramElement() : fObj(nullptr) { }
      22             : 
      23             :     // Adds a pending execution on obj.
      24             :     explicit GrPendingProgramElement(T* obj) : fObj(obj)  {
      25             :         if (obj) {
      26             :             obj->addPendingExecution();
      27             :         }
      28             :     }
      29             : 
      30           0 :     void reset(T* obj) {
      31           0 :         if (obj) {
      32           0 :             obj->addPendingExecution();
      33             :         }
      34           0 :         if (fObj) {
      35           0 :             fObj->completedExecution();
      36             :         }
      37           0 :         fObj = obj;
      38           0 :     }
      39             : 
      40           0 :     T* get() const { return fObj; }
      41           0 :     operator T*() { return fObj; }
      42             : 
      43             :     T *operator->() const { return fObj; }
      44             : 
      45           0 :     ~GrPendingProgramElement() {
      46           0 :         if (fObj) {
      47           0 :             fObj->completedExecution();
      48             :         }
      49           0 :     }
      50             : 
      51             : private:
      52             :     T*   fObj;
      53             : 
      54             :     typedef SkNoncopyable INHERITED;
      55             : };
      56             : #endif

Generated by: LCOV version 1.13