Remove gl::LinkResult.

Instead of returning a small struct from LinkProgram calls we use
angle::Result. Linking can have 3 cases:

- the link was successful -> angle::Result::Continue
- the link failed -> angle::Result::Incomplete
- there was an internal error -> angle::Result::Stop

Note that any unexpected Incomplete is still an error. Each function
that accepts Incomplete must check explicitly.

This is the last user of ErrorOrResult.

Bug: angleproject:2491
Change-Id: Idba23be27efe4b561720a4bdd8fe486b40779497
Reviewed-on: https://chromium-review.googlesource.com/c/1255645
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@google.com>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 1661473..2422d2b 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -1129,8 +1129,9 @@
 
     if (cache)
     {
-        ANGLE_TRY_RESULT(cache->getProgram(context, this, &mState, &programHash), mLinked);
-        ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess", mLinked);
+        angle::Result result = cache->getProgram(context, this, &mState, &programHash);
+        mLinked              = (result == angle::Result::Continue());
+        ANGLE_TRY(result);
     }
 
     if (mLinked)
@@ -1288,11 +1289,13 @@
     return (mLinkingState.get() && mLinkingState->linkEvent->isLinking());
 }
 
-void Program::resolveLinkImpl()
+void Program::resolveLinkImpl(const Context *context)
 {
     ASSERT(mLinkingState.get());
 
-    mLinked           = mLinkingState->linkEvent->wait();
+    angle::Result result = mLinkingState->linkEvent->wait(context);
+
+    mLinked           = result == angle::Result::Continue();
     mLinkResolved     = true;
     auto linkingState = std::move(mLinkingState);
     if (!mLinked)
@@ -1448,11 +1451,13 @@
     }
 
     const uint8_t *bytes = reinterpret_cast<const uint8_t *>(binary);
-    ANGLE_TRY_RESULT(
-        MemoryProgramCache::Deserialize(context, this, &mState, bytes, length, mInfoLog), mLinked);
+    angle::Result result =
+        MemoryProgramCache::Deserialize(context, this, &mState, bytes, length, mInfoLog);
+    mLinked = result == angle::Result::Continue();
+    ANGLE_TRY(result);
 
     // Currently we require the full shader text to compute the program hash.
-    // TODO(jmadill): Store the binary in the internal program cache.
+    // We could also store the binary in the internal program cache.
 
     for (size_t uniformBlockIndex = 0; uniformBlockIndex < mState.mUniformBlocks.size();
          ++uniformBlockIndex)