Implement TransformFeedbackManager in GPU command buffer.

A few design points:
1) create a "default" transform feedback for each context (instead of using
   the default 0). This will make context switching easier.
2) Emulate BindBufferRange behaviors on GL 4.1 or lower by tracking indexed
   buffer bindings.

WHat's left to be done:
1) Intercept GetIntegeri_v and GetIntegeri64_v on GL 4.1 or lower (due to the
   emulation)
2) Hook up indexed buffer bindings to Program (for uniform buffer bindings)

BUG=604436
TEST=gpu_unittests,webgl2_conformance
R=piman@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel;tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/1922633002
Cr-Commit-Position: refs/heads/master@{#391605}
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h
index 80687b7d..3a44730 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -29,6 +29,7 @@
 class Logger;
 class Program;
 class Renderbuffer;
+class TransformFeedback;
 
 // State associated with each texture unit.
 struct GPU_EXPORT TextureUnit {
@@ -188,6 +189,7 @@
   void RestoreGlobalState(const ContextState* prev_state) const;
   void RestoreProgramBindings() const;
   void RestoreRenderbufferBindings();
+  void RestoreTransformFeedbackBindings(const ContextState* prev_state);
   void RestoreTextureUnitBindings(
       GLuint unit, const ContextState* prev_state) const;
 
@@ -273,6 +275,14 @@
   // Which samplers are bound to each texture unit;
   std::vector<scoped_refptr<Sampler>> sampler_units;
 
+  // We create a transform feedback as the default one per ES3 enabled context
+  // instead of using GL's default one to make context switching easier.
+  // For other context, we will never change the default transform feedback's
+  // states, so we can just use the GL's default one.
+  scoped_refptr<TransformFeedback> default_transform_feedback;
+
+  scoped_refptr<TransformFeedback> bound_transform_feedback;
+
   // The values for each attrib.
   std::vector<Vec4> attrib_values;