Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Issue 2443003004: cc: Make OutputSurface::BindToClient pure virtual and not return bool (Closed)

Created:
4 years, 1 month ago by danakj
Modified:
4 years, 1 month ago
CC:
cc-bugs_chromium.org, chromium-reviews, danakj+watch_chromium.org, darin-cc_chromium.org, einbinder+watch-test-runner_chromium.org, jam, jbauman+watch_chromium.org, jochen+watch_chromium.org, kalyank, mlamouri+watch-test-runner_chromium.org, piman+watch_chromium.org, rjkroege, sievers+watch_chromium.org, Ian Vollick
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

cc: Make OutputSurface::BindToClient pure virtual and not return bool The function does not need to return bool and we DCHECK it is always true already, since the ContextProvider given to the OutputSurface can be initialized before even creating the OutputSurface as it is not used across threads anymore. Since it is not cross-thread the base class code in BindToClient can move to its constructor and the method can become pure virtual. Drops the DidLoseOutputSurface from the OutputSurfaceClient interface so that every implementation doesn't need to bind it - esp since only OutputSurfaces with a context can even get lost. Instead have Display listen to the context for loss. And some random code cleanups in AndroidOutputSurface since it was working around multiple threads that don't exist. R=enne@chromium.org, piman@chromium.org BUG=606056 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel Committed: https://crrev.com/94486a41405a0a792a0aed2324b9a841d536d853 Cr-Commit-Position: refs/heads/master@{#427511}

Patch Set 1 #

Patch Set 2 : bindtoclient-pure-virtual: . #

Patch Set 3 : bindtoclient-pure-virtual: rebsae #

Total comments: 3

Patch Set 4 : bindtoclient-pure-virtual: . #

Patch Set 5 : bindtoclient-pure-virtual: . #

Total comments: 2

Patch Set 6 : bindtoclient-pure-virtual: . #

Total comments: 13

Patch Set 7 : bindtoclient-pure-virtual: blimp-bind #

Patch Set 8 : bindtoclient-pure-virtual: rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+297 lines, -408 lines) Patch
M android_webview/browser/parent_output_surface.h View 1 1 chunk +1 line, -1 line 0 comments Download
M android_webview/browser/parent_output_surface.cc View 1 1 chunk +1 line, -4 lines 0 comments Download
M android_webview/browser/surfaces_instance.h View 1 1 chunk +1 line, -1 line 0 comments Download
M android_webview/browser/surfaces_instance.cc View 1 1 chunk +5 lines, -0 lines 0 comments Download
M blimp/client/support/compositor/blimp_embedder_compositor.cc View 1 2 3 4 5 6 3 chunks +6 lines, -0 lines 0 comments Download
M cc/BUILD.gn View 1 1 chunk +0 lines, -1 line 0 comments Download
M cc/output/context_provider.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M cc/output/gl_renderer_unittest.cc View 21 chunks +94 lines, -60 lines 0 comments Download
M cc/output/output_surface.h View 1 2 3 chunks +2 lines, -12 lines 0 comments Download
M cc/output/output_surface.cc View 1 chunk +1 line, -35 lines 0 comments Download
M cc/output/output_surface_client.h View 1 1 chunk +0 lines, -5 lines 0 comments Download
M cc/output/output_surface_unittest.cc View 1 1 chunk +0 lines, -124 lines 0 comments Download
M cc/output/overlay_unittest.cc View 6 chunks +7 lines, -7 lines 0 comments Download
M cc/output/software_renderer_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M cc/surfaces/display.h View 1 2 chunks +1 line, -1 line 0 comments Download
M cc/surfaces/display.cc View 1 4 chunks +22 lines, -12 lines 0 comments Download
M cc/surfaces/display_unittest.cc View 1 3 chunks +30 lines, -1 line 0 comments Download
M cc/test/fake_output_surface.h View 3 chunks +7 lines, -18 lines 0 comments Download
M cc/test/fake_output_surface.cc View 1 1 chunk +4 lines, -7 lines 0 comments Download
M cc/test/fake_output_surface_client.h View 1 1 chunk +0 lines, -6 lines 0 comments Download
M cc/test/fake_output_surface_client.cc View 1 1 chunk +0 lines, -4 lines 0 comments Download
M cc/test/layer_tree_pixel_test.cc View 1 chunk +8 lines, -5 lines 0 comments Download
M cc/test/pixel_test_output_surface.h View 2 chunks +2 lines, -0 lines 0 comments Download
M cc/test/pixel_test_output_surface.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_unittest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M cc/trees/layer_tree_host_unittest_copyrequest.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/compositor/browser_compositor_output_surface.cc View 1 chunk +0 lines, -2 lines 0 comments Download
M content/browser/compositor/gpu_browser_compositor_output_surface.h View 2 chunks +2 lines, -1 line 0 comments Download
M content/browser/compositor/gpu_browser_compositor_output_surface.cc View 3 chunks +10 lines, -10 lines 0 comments Download
M content/browser/compositor/mus_browser_compositor_output_surface.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/compositor/mus_browser_compositor_output_surface.cc View 1 2 2 chunks +1 line, -8 lines 0 comments Download
M content/browser/compositor/offscreen_browser_compositor_output_surface.h View 2 chunks +7 lines, -7 lines 0 comments Download
M content/browser/compositor/offscreen_browser_compositor_output_surface.cc View 1 chunk +7 lines, -0 lines 0 comments Download
M content/browser/compositor/reflector_impl_unittest.cc View 1 2 3 4 4 chunks +6 lines, -5 lines 0 comments Download
M content/browser/compositor/software_browser_compositor_output_surface.h View 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/compositor/software_browser_compositor_output_surface.cc View 2 chunks +8 lines, -0 lines 0 comments Download
M content/browser/compositor/software_browser_compositor_output_surface_unittest.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/compositor_impl_android.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M content/browser/renderer_host/compositor_impl_android.cc View 1 2 6 chunks +17 lines, -33 lines 0 comments Download
M content/renderer/android/synchronous_compositor_frame_sink.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/test/layouttest_support.cc View 1 chunk +11 lines, -9 lines 0 comments Download
M services/ui/surfaces/direct_output_surface.h View 2 chunks +2 lines, -1 line 0 comments Download
M services/ui/surfaces/direct_output_surface.cc View 1 1 chunk +7 lines, -10 lines 0 comments Download
M services/ui/surfaces/direct_output_surface_ozone.h View 2 chunks +3 lines, -1 line 0 comments Download
M services/ui/surfaces/direct_output_surface_ozone.cc View 1 2 3 1 chunk +4 lines, -9 lines 0 comments Download
M ui/compositor/test/in_process_context_factory.cc View 2 chunks +3 lines, -2 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 61 (37 generated)
danakj
enne: overall piman: content boliu: aw fsamuel: services
4 years, 1 month ago (2016-10-24 23:29:48 UTC) #8
Fady Samuel
lgtm
4 years, 1 month ago (2016-10-24 23:50:35 UTC) #14
boliu
https://codereview.chromium.org/2443003004/diff/40001/content/browser/compositor/gpu_browser_compositor_output_surface.cc File content/browser/compositor/gpu_browser_compositor_output_surface.cc (right): https://codereview.chromium.org/2443003004/diff/40001/content/browser/compositor/gpu_browser_compositor_output_surface.cc#newcode36 content/browser/compositor/gpu_browser_compositor_output_surface.cc:36: context_provider()->ContextCapabilities().flips_vertically; is accessing the context safe here? or is ...
4 years, 1 month ago (2016-10-25 00:07:35 UTC) #17
danakj
https://codereview.chromium.org/2443003004/diff/40001/content/browser/compositor/gpu_browser_compositor_output_surface.cc File content/browser/compositor/gpu_browser_compositor_output_surface.cc (right): https://codereview.chromium.org/2443003004/diff/40001/content/browser/compositor/gpu_browser_compositor_output_surface.cc#newcode36 content/browser/compositor/gpu_browser_compositor_output_surface.cc:36: context_provider()->ContextCapabilities().flips_vertically; On 2016/10/25 00:07:35, boliu wrote: > is accessing ...
4 years, 1 month ago (2016-10-25 00:11:02 UTC) #18
danakj
https://codereview.chromium.org/2443003004/diff/40001/content/browser/compositor/gpu_browser_compositor_output_surface.cc File content/browser/compositor/gpu_browser_compositor_output_surface.cc (right): https://codereview.chromium.org/2443003004/diff/40001/content/browser/compositor/gpu_browser_compositor_output_surface.cc#newcode36 content/browser/compositor/gpu_browser_compositor_output_surface.cc:36: context_provider()->ContextCapabilities().flips_vertically; On 2016/10/25 00:11:01, danakj wrote: > On 2016/10/25 ...
4 years, 1 month ago (2016-10-25 00:11:44 UTC) #19
boliu
lgtm
4 years, 1 month ago (2016-10-25 00:26:36 UTC) #24
piman
lgtm https://codereview.chromium.org/2443003004/diff/80001/content/browser/renderer_host/compositor_impl_android.cc File content/browser/renderer_host/compositor_impl_android.cc (right): https://codereview.chromium.org/2443003004/diff/80001/content/browser/renderer_host/compositor_impl_android.cc#newcode301 content/browser/renderer_host/compositor_impl_android.cc:301: base::WeakPtrFactory<AndroidOutputSurface> weak_ptr_factory_; I /think/ it's not necessary because ...
4 years, 1 month ago (2016-10-25 00:47:44 UTC) #29
danakj
+khushalsagar for blimp
4 years, 1 month ago (2016-10-25 00:49:33 UTC) #31
danakj
https://codereview.chromium.org/2443003004/diff/80001/content/browser/renderer_host/compositor_impl_android.cc File content/browser/renderer_host/compositor_impl_android.cc (right): https://codereview.chromium.org/2443003004/diff/80001/content/browser/renderer_host/compositor_impl_android.cc#newcode301 content/browser/renderer_host/compositor_impl_android.cc:301: base::WeakPtrFactory<AndroidOutputSurface> weak_ptr_factory_; On 2016/10/25 00:47:44, piman wrote: > I ...
4 years, 1 month ago (2016-10-25 00:50:19 UTC) #33
Khushal
https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc File blimp/client/support/compositor/blimp_embedder_compositor.cc (right): https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc#newcode200 blimp/client/support/compositor/blimp_embedder_compositor.cc:200: DCHECK(context_provider_); Should we context_provider_->BindToCurrentThread() here and DCHECK that it ...
4 years, 1 month ago (2016-10-25 01:10:02 UTC) #35
Khushal
https://codereview.chromium.org/2443003004/diff/100001/content/browser/renderer_host/compositor_impl_android.cc File content/browser/renderer_host/compositor_impl_android.cc (right): https://codereview.chromium.org/2443003004/diff/100001/content/browser/renderer_host/compositor_impl_android.cc#newcode689 content/browser/renderer_host/compositor_impl_android.cc:689: context_provider_command_buffer->BindToCurrentThread(); On 2016/10/25 01:10:02, Khushal wrote: > Btw, do ...
4 years, 1 month ago (2016-10-25 01:28:35 UTC) #36
enne (OOO)
https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc File cc/output/gl_renderer_unittest.cc (right): https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc#newcode602 cc/output/gl_renderer_unittest.cc:602: auto provider = TestContextProvider::Create(std::move(context)); Should TestContextProvider just BindToCurrentThread in ...
4 years, 1 month ago (2016-10-25 18:22:59 UTC) #39
danakj
https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc File cc/output/gl_renderer_unittest.cc (right): https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc#newcode602 cc/output/gl_renderer_unittest.cc:602: auto provider = TestContextProvider::Create(std::move(context)); On 2016/10/25 18:22:59, enne wrote: ...
4 years, 1 month ago (2016-10-25 18:54:19 UTC) #40
danakj
https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc File blimp/client/support/compositor/blimp_embedder_compositor.cc (right): https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc#newcode200 blimp/client/support/compositor/blimp_embedder_compositor.cc:200: DCHECK(context_provider_); On 2016/10/25 01:10:02, Khushal wrote: > Should we ...
4 years, 1 month ago (2016-10-25 18:58:39 UTC) #41
danakj
https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc File blimp/client/support/compositor/blimp_embedder_compositor.cc (right): https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc#newcode200 blimp/client/support/compositor/blimp_embedder_compositor.cc:200: DCHECK(context_provider_); On 2016/10/25 18:58:38, danakj wrote: > On 2016/10/25 ...
4 years, 1 month ago (2016-10-25 19:00:00 UTC) #42
enne (OOO)
https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc File cc/output/gl_renderer_unittest.cc (right): https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc#newcode602 cc/output/gl_renderer_unittest.cc:602: auto provider = TestContextProvider::Create(std::move(context)); On 2016/10/25 at 18:54:18, danakj ...
4 years, 1 month ago (2016-10-25 20:01:14 UTC) #43
danakj
https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc File cc/output/gl_renderer_unittest.cc (right): https://codereview.chromium.org/2443003004/diff/100001/cc/output/gl_renderer_unittest.cc#newcode602 cc/output/gl_renderer_unittest.cc:602: auto provider = TestContextProvider::Create(std::move(context)); On 2016/10/25 20:01:14, enne wrote: ...
4 years, 1 month ago (2016-10-25 20:12:00 UTC) #44
enne (OOO)
I still think this is a lot of boilerplate that could be cleaned up here ...
4 years, 1 month ago (2016-10-25 20:25:10 UTC) #47
danakj
On Tue, Oct 25, 2016 at 1:25 PM, enne@chromium.org via chromiumcodereview-hr.appspot.com < reply@chromiumcodereview-hr.appspotmail.com> wrote: > ...
4 years, 1 month ago (2016-10-25 20:27:56 UTC) #48
Khushal
lgtm. https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc File blimp/client/support/compositor/blimp_embedder_compositor.cc (right): https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc#newcode200 blimp/client/support/compositor/blimp_embedder_compositor.cc:200: DCHECK(context_provider_); On 2016/10/25 19:00:00, danakj wrote: > On ...
4 years, 1 month ago (2016-10-25 20:45:06 UTC) #49
danakj
https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc File blimp/client/support/compositor/blimp_embedder_compositor.cc (right): https://codereview.chromium.org/2443003004/diff/100001/blimp/client/support/compositor/blimp_embedder_compositor.cc#newcode200 blimp/client/support/compositor/blimp_embedder_compositor.cc:200: DCHECK(context_provider_); On 2016/10/25 20:45:06, Khushal wrote: > On 2016/10/25 ...
4 years, 1 month ago (2016-10-25 20:47:23 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2443003004/140001
4 years, 1 month ago (2016-10-25 22:15:42 UTC) #58
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/94486a41405a0a792a0aed2324b9a841d536d853 Cr-Commit-Position: refs/heads/master@{#427511}
4 years, 1 month ago (2016-10-25 22:34:01 UTC) #60
commit-bot: I haz the power
4 years, 1 month ago (2016-10-25 22:34:21 UTC) #61
Message was sent while issue was closed.
Failed to apply patch for cc/output/output_surface_unittest.cc:
While running git rm cc/output/output_surface_unittest.cc;
  fatal: pathspec 'cc/output/output_surface_unittest.cc' did not match any files

Patch:  D    cc/output/output_surface_unittest.cc
Index: cc/output/output_surface_unittest.cc
diff --git a/cc/output/output_surface_unittest.cc
b/cc/output/output_surface_unittest.cc
deleted file mode 100644
index
2c40578117a2b27e0374bebb14f4f8142fad3027..0000000000000000000000000000000000000000
--- a/cc/output/output_surface_unittest.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/output/output_surface.h"
-
-#include <utility>
-
-#include "base/memory/ptr_util.h"
-#include "cc/output/output_surface_frame.h"
-#include "cc/output/software_output_device.h"
-#include "cc/test/fake_output_surface_client.h"
-#include "cc/test/test_context_provider.h"
-#include "cc/test/test_web_graphics_context_3d.h"
-#include "gpu/GLES2/gl2extchromium.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cc {
-namespace {
-
-class TestOutputSurface : public OutputSurface {
- public:
-  explicit TestOutputSurface(
-      scoped_refptr<TestContextProvider> context_provider)
-      : OutputSurface(std::move(context_provider)) {}
-
-  explicit TestOutputSurface(
-      std::unique_ptr<SoftwareOutputDevice> software_device)
-      : OutputSurface(std::move(software_device)) {}
-
-  void EnsureBackbuffer() override {}
-  void DiscardBackbuffer() override {}
-  void BindFramebuffer() override {}
-  void Reshape(const gfx::Size& size,
-               float device_scale_factor,
-               const gfx::ColorSpace& color_space,
-               bool has_alpha) override {}
-  void SwapBuffers(OutputSurfaceFrame frame) override {
-    client_->DidReceiveSwapBuffersAck();
-  }
-  uint32_t GetFramebufferCopyTextureFormat() override {
-    // TestContextProvider has no real framebuffer, just use RGB.
-    return GL_RGB;
-  }
-  OverlayCandidateValidator* GetOverlayCandidateValidator() const override {
-    return nullptr;
-  }
-  bool IsDisplayedAsOverlayPlane() const override { return false; }
-  unsigned GetOverlayTextureId() const override { return 0; }
-  bool SurfaceIsSuspendForRecycle() const override { return false; }
-  bool HasExternalStencilTest() const override { return false; }
-  void ApplyExternalStencil() override {}
-
-  void OnSwapBuffersCompleteForTesting() {
-    client_->DidReceiveSwapBuffersAck();
-  }
-
- protected:
-};
-
-class TestSoftwareOutputDevice : public SoftwareOutputDevice {
- public:
-  TestSoftwareOutputDevice();
-  ~TestSoftwareOutputDevice() override;
-
-  // Overriden from cc:SoftwareOutputDevice
-  void DiscardBackbuffer() override;
-  void EnsureBackbuffer() override;
-
-  int discard_backbuffer_count() { return discard_backbuffer_count_; }
-  int ensure_backbuffer_count() { return ensure_backbuffer_count_; }
-
- private:
-  int discard_backbuffer_count_;
-  int ensure_backbuffer_count_;
-};
-
-TestSoftwareOutputDevice::TestSoftwareOutputDevice()
-    : discard_backbuffer_count_(0), ensure_backbuffer_count_(0) {}
-
-TestSoftwareOutputDevice::~TestSoftwareOutputDevice() {}
-
-void TestSoftwareOutputDevice::DiscardBackbuffer() {
-  SoftwareOutputDevice::DiscardBackbuffer();
-  discard_backbuffer_count_++;
-}
-
-void TestSoftwareOutputDevice::EnsureBackbuffer() {
-  SoftwareOutputDevice::EnsureBackbuffer();
-  ensure_backbuffer_count_++;
-}
-
-TEST(OutputSurfaceTest, ContextLossInformsClient) {
-  scoped_refptr<TestContextProvider> provider = TestContextProvider::Create();
-  TestOutputSurface output_surface(provider);
-
-  FakeOutputSurfaceClient client;
-  EXPECT_TRUE(output_surface.BindToClient(&client));
-
-  // Verify DidLoseOutputSurface callback is hooked up correctly.
-  EXPECT_FALSE(client.did_lose_output_surface_called());
-  output_surface.context_provider()->ContextGL()->LoseContextCHROMIUM(
-      GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
-  output_surface.context_provider()->ContextGL()->Flush();
-  EXPECT_TRUE(client.did_lose_output_surface_called());
-}
-
-// TODO(danakj): Add a test for worker context failure as well when
-// OutputSurface creates/binds it.
-TEST(OutputSurfaceTest, ContextLossFailsBind) {
-  scoped_refptr<TestContextProvider> context_provider =
-      TestContextProvider::Create();
-
-  // Lose the context so BindToClient fails.
-  context_provider->UnboundTestContext3d()->set_context_lost(true);
-
-  TestOutputSurface output_surface(context_provider);
-
-  FakeOutputSurfaceClient client;
-  EXPECT_FALSE(output_surface.BindToClient(&client));
-}
-
-}  // namespace
-}  // namespace cc

Powered by Google App Engine
This is Rietveld 408576698