Add GrBackendMutableState object to handle shared texture state.

This is will be the main struct used to synchronize changes of certain
texture/image between clients and Skia. With this change we
implement support for the Vulkan shared state as POC.

Bug: skia:10254
Change-Id: I10543357635c347838b193874e4da4496a0dcf06
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292311
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrBackendSurfaceMutableStateImpl.h b/src/gpu/GrBackendSurfaceMutableStateImpl.h
new file mode 100644
index 0000000..3e3bc92
--- /dev/null
+++ b/src/gpu/GrBackendSurfaceMutableStateImpl.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrBackendSurfaceMutableStateImpl_DEFINED
+#define GrBackendSurfaceMutableStateImpl_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/gpu/GrBackendSurfaceMutableState.h"
+
+class GrBackendSurfaceMutableStateImpl : public SkRefCnt {
+public:
+#ifdef SK_VULKAN
+    GrBackendSurfaceMutableStateImpl(VkImageLayout layout, uint32_t queueFamilyIndex)
+            : fState(layout, queueFamilyIndex) {}
+
+    GrBackendSurfaceMutableStateImpl(GrVkSharedImageInfo sharedInfo)
+            : fState(sharedInfo.getImageLayout(), sharedInfo.getQueueFamilyIndex()) {}
+#endif
+
+    void set(const GrBackendSurfaceMutableState& state) { fState = state; }
+
+#ifdef SK_VULKAN
+    VkImageLayout getImageLayout() const {
+        SkASSERT(fState.fBackend == GrBackend::kVulkan);
+        return fState.fVkState.getImageLayout();
+    }
+
+    void setImageLayout(VkImageLayout layout) {
+        SkASSERT(fState.fBackend == GrBackend::kVulkan);
+        fState.fVkState.setImageLayout(layout);
+    }
+
+    uint32_t getQueueFamilyIndex() const {
+        SkASSERT(fState.fBackend == GrBackend::kVulkan);
+        return fState.fVkState.getQueueFamilyIndex();
+    }
+
+    void setQueueFamilyIndex(uint32_t queueFamilyIndex) {
+        SkASSERT(fState.fBackend == GrBackend::kVulkan);
+        fState.fVkState.setQueueFamilyIndex(queueFamilyIndex);
+    }
+
+    const GrVkSharedImageInfo& getVkSharedImageInfo() {
+        SkASSERT(fState.fBackend == GrBackend::kVulkan);
+        return fState.fVkState;
+    }
+#endif
+
+
+private:
+    GrBackendSurfaceMutableState fState;
+};
+
+#endif