Pass Context to setLabel.

This is useful for triggering a dirty state notification for Textures.
It will lead to improvements for program and texture dirty bits.

Bug: angleproject:2966
Change-Id: Iaba625da8a970a558f7d158bfa2f09c964f6761a
Reviewed-on: https://chromium-review.googlesource.com/c/1347669
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/Buffer.cpp b/src/libANGLE/Buffer.cpp
index 94afe14..b6fe317 100644
--- a/src/libANGLE/Buffer.cpp
+++ b/src/libANGLE/Buffer.cpp
@@ -58,7 +58,7 @@
         mImpl->destroy(context);
 }
 
-void Buffer::setLabel(const std::string &label)
+void Buffer::setLabel(const Context *context, const std::string &label)
 {
     mState.mLabel = label;
 }
diff --git a/src/libANGLE/Buffer.h b/src/libANGLE/Buffer.h
index 4150018..3873d9e 100644
--- a/src/libANGLE/Buffer.h
+++ b/src/libANGLE/Buffer.h
@@ -73,7 +73,7 @@
     ~Buffer() override;
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     angle::Result bufferData(Context *context,
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index d5ec259..54b6f9a 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -1030,7 +1030,7 @@
     ASSERT(object != nullptr);
 
     std::string labelName = GetObjectLabelFromPointer(length, label);
-    object->setLabel(labelName);
+    object->setLabel(this, labelName);
 
     // TODO(jmadill): Determine if the object is dirty based on 'name'. Conservatively assume the
     // specified object is active until we do this.
@@ -1043,7 +1043,7 @@
     ASSERT(object != nullptr);
 
     std::string labelName = GetObjectLabelFromPointer(length, label);
-    object->setLabel(labelName);
+    object->setLabel(this, labelName);
 }
 
 void Context::getObjectLabel(GLenum identifier,
diff --git a/src/libANGLE/Debug.h b/src/libANGLE/Debug.h
index 544512a..79b6de7 100644
--- a/src/libANGLE/Debug.h
+++ b/src/libANGLE/Debug.h
@@ -20,12 +20,13 @@
 
 namespace gl
 {
+class Context;
 
 class LabeledObject
 {
   public:
     virtual ~LabeledObject() {}
-    virtual void setLabel(const std::string &label) = 0;
+    virtual void setLabel(const Context *context, const std::string &label) = 0;
     virtual const std::string &getLabel() const     = 0;
 };
 
diff --git a/src/libANGLE/Fence.cpp b/src/libANGLE/Fence.cpp
index 822888f..9c16853 100644
--- a/src/libANGLE/Fence.cpp
+++ b/src/libANGLE/Fence.cpp
@@ -73,7 +73,7 @@
     SafeDelete(mFence);
 }
 
-void Sync::setLabel(const std::string &label)
+void Sync::setLabel(const Context *context, const std::string &label)
 {
     mLabel = label;
 }
diff --git a/src/libANGLE/Fence.h b/src/libANGLE/Fence.h
index 1f839a2..abd30bf 100644
--- a/src/libANGLE/Fence.h
+++ b/src/libANGLE/Fence.h
@@ -56,7 +56,7 @@
 
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     angle::Result set(const Context *context, GLenum condition, GLbitfield flags);
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index f3f9bfc..3acedca 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -707,7 +707,7 @@
     mImpl->destroy(context);
 }
 
-void Framebuffer::setLabel(const std::string &label)
+void Framebuffer::setLabel(const Context *context, const std::string &label)
 {
     mState.mLabel = label;
 }
diff --git a/src/libANGLE/Framebuffer.h b/src/libANGLE/Framebuffer.h
index 3fe0055..112350f 100644
--- a/src/libANGLE/Framebuffer.h
+++ b/src/libANGLE/Framebuffer.h
@@ -164,7 +164,7 @@
     ~Framebuffer() override;
     void onDestroy(const Context *context);
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     rx::FramebufferImpl *getImplementation() const { return mImpl; }
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 5e237c2..8a67428 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -931,7 +931,7 @@
     return mHandle;
 }
 
-void Program::setLabel(const std::string &label)
+void Program::setLabel(const Context *context, const std::string &label)
 {
     ASSERT(mLinkResolved);
     mState.mLabel = label;
diff --git a/src/libANGLE/Program.h b/src/libANGLE/Program.h
index 22bbc5f..945d7bf 100644
--- a/src/libANGLE/Program.h
+++ b/src/libANGLE/Program.h
@@ -497,7 +497,7 @@
 
     GLuint id() const;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     ANGLE_INLINE rx::ProgramImpl *getImplementation() const
diff --git a/src/libANGLE/ProgramPipeline.cpp b/src/libANGLE/ProgramPipeline.cpp
index 8a121cf..bacd2ed 100644
--- a/src/libANGLE/ProgramPipeline.cpp
+++ b/src/libANGLE/ProgramPipeline.cpp
@@ -39,7 +39,7 @@
 
 void ProgramPipeline::onDestroy(const Context *context) {}
 
-void ProgramPipeline::setLabel(const std::string &label)
+void ProgramPipeline::setLabel(const Context *context, const std::string &label)
 {
     mState.mLabel = label;
 }
diff --git a/src/libANGLE/ProgramPipeline.h b/src/libANGLE/ProgramPipeline.h
index fccf3f3..8741eeb 100644
--- a/src/libANGLE/ProgramPipeline.h
+++ b/src/libANGLE/ProgramPipeline.h
@@ -50,7 +50,7 @@
 
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     rx::ProgramPipelineImpl *getImplementation() const;
diff --git a/src/libANGLE/Query.cpp b/src/libANGLE/Query.cpp
index 02fe1fb..47aa265 100644
--- a/src/libANGLE/Query.cpp
+++ b/src/libANGLE/Query.cpp
@@ -24,7 +24,7 @@
     mQuery->onDestroy(context);
 }
 
-void Query::setLabel(const std::string &label)
+void Query::setLabel(const Context *context, const std::string &label)
 {
     mLabel = label;
 }
diff --git a/src/libANGLE/Query.h b/src/libANGLE/Query.h
index 706c4f9..a19256e 100644
--- a/src/libANGLE/Query.h
+++ b/src/libANGLE/Query.h
@@ -33,7 +33,7 @@
     ~Query() override;
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     angle::Result begin(const Context *context);
diff --git a/src/libANGLE/Renderbuffer.cpp b/src/libANGLE/Renderbuffer.cpp
index e60cfb7..f25f8cb 100644
--- a/src/libANGLE/Renderbuffer.cpp
+++ b/src/libANGLE/Renderbuffer.cpp
@@ -82,7 +82,7 @@
 
 Renderbuffer::~Renderbuffer() {}
 
-void Renderbuffer::setLabel(const std::string &label)
+void Renderbuffer::setLabel(const Context *context, const std::string &label)
 {
     mLabel = label;
 }
diff --git a/src/libANGLE/Renderbuffer.h b/src/libANGLE/Renderbuffer.h
index d3b4821..d2cf078 100644
--- a/src/libANGLE/Renderbuffer.h
+++ b/src/libANGLE/Renderbuffer.h
@@ -69,7 +69,7 @@
 
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     angle::Result setStorage(const Context *context,
diff --git a/src/libANGLE/Sampler.cpp b/src/libANGLE/Sampler.cpp
index be04ac2..63ca3f8 100644
--- a/src/libANGLE/Sampler.cpp
+++ b/src/libANGLE/Sampler.cpp
@@ -26,7 +26,7 @@
 
 void Sampler::onDestroy(const Context *context) {}
 
-void Sampler::setLabel(const std::string &label)
+void Sampler::setLabel(const Context *context, const std::string &label)
 {
     mLabel = label;
 }
diff --git a/src/libANGLE/Sampler.h b/src/libANGLE/Sampler.h
index 92946c7..4d17a6f 100644
--- a/src/libANGLE/Sampler.h
+++ b/src/libANGLE/Sampler.h
@@ -32,7 +32,7 @@
 
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     void setMinFilter(GLenum minFilter);
diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp
index 87d213b..4d963f8 100644
--- a/src/libANGLE/Shader.cpp
+++ b/src/libANGLE/Shader.cpp
@@ -186,7 +186,7 @@
     ASSERT(!mImplementation);
 }
 
-void Shader::setLabel(const std::string &label)
+void Shader::setLabel(const Context *context, const std::string &label)
 {
     mState.mLabel = label;
 }
diff --git a/src/libANGLE/Shader.h b/src/libANGLE/Shader.h
index 86fc0d5..8e71ed1 100644
--- a/src/libANGLE/Shader.h
+++ b/src/libANGLE/Shader.h
@@ -131,7 +131,7 @@
 
     void onDestroy(const Context *context);
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     ShaderType getType() const { return mType; }
diff --git a/src/libANGLE/Texture.cpp b/src/libANGLE/Texture.cpp
index fb111d2..0bfbe8c 100644
--- a/src/libANGLE/Texture.cpp
+++ b/src/libANGLE/Texture.cpp
@@ -627,7 +627,7 @@
     SafeDelete(mTexture);
 }
 
-void Texture::setLabel(const std::string &label)
+void Texture::setLabel(const Context *context, const std::string &label)
 {
     mLabel = label;
     mDirtyBits.set(DIRTY_BIT_LABEL);
diff --git a/src/libANGLE/Texture.h b/src/libANGLE/Texture.h
index 59363e8..0f18294 100644
--- a/src/libANGLE/Texture.h
+++ b/src/libANGLE/Texture.h
@@ -201,7 +201,7 @@
 
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     TextureType getType() const { return mState.mType; }
diff --git a/src/libANGLE/TransformFeedback.cpp b/src/libANGLE/TransformFeedback.cpp
index 758e1b4..e4cd583 100644
--- a/src/libANGLE/TransformFeedback.cpp
+++ b/src/libANGLE/TransformFeedback.cpp
@@ -98,7 +98,7 @@
     SafeDelete(mImplementation);
 }
 
-void TransformFeedback::setLabel(const std::string &label)
+void TransformFeedback::setLabel(const Context *context, const std::string &label)
 {
     mState.mLabel = label;
 }
diff --git a/src/libANGLE/TransformFeedback.h b/src/libANGLE/TransformFeedback.h
index 464939e..95bfb1a 100644
--- a/src/libANGLE/TransformFeedback.h
+++ b/src/libANGLE/TransformFeedback.h
@@ -60,7 +60,7 @@
     ~TransformFeedback() override;
     void onDestroy(const Context *context) override;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     void begin(const Context *context, PrimitiveMode primitiveMode, Program *program);
diff --git a/src/libANGLE/VertexArray.cpp b/src/libANGLE/VertexArray.cpp
index 440da98..3b0d3b8 100644
--- a/src/libANGLE/VertexArray.cpp
+++ b/src/libANGLE/VertexArray.cpp
@@ -127,7 +127,7 @@
     return mId;
 }
 
-void VertexArray::setLabel(const std::string &label)
+void VertexArray::setLabel(const Context *context, const std::string &label)
 {
     mState.mLabel = label;
 }
diff --git a/src/libANGLE/VertexArray.h b/src/libANGLE/VertexArray.h
index 6e86b7d..f3803d46 100644
--- a/src/libANGLE/VertexArray.h
+++ b/src/libANGLE/VertexArray.h
@@ -106,7 +106,7 @@
 
     GLuint id() const;
 
-    void setLabel(const std::string &label) override;
+    void setLabel(const Context *context, const std::string &label) override;
     const std::string &getLabel() const override;
 
     const VertexBinding &getVertexBinding(size_t bindingIndex) const;