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

Unified Diff: content/browser/aura/browser_compositor_output_surface.cc

Issue 22935009: Add content::SurfaceCapturer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_stride
Patch Set: 89e2665f Rebase. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/aura/browser_compositor_output_surface.cc
diff --git a/content/browser/aura/browser_compositor_output_surface.cc b/content/browser/aura/browser_compositor_output_surface.cc
index 36e5dcdbfda672864c396c8d69386296dbb33197..0a6969e00d0588c1d769edfd20eda6a34c6c6799 100644
--- a/content/browser/aura/browser_compositor_output_surface.cc
+++ b/content/browser/aura/browser_compositor_output_surface.cc
@@ -10,6 +10,7 @@
#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/string_number_conversions.h"
#include "cc/output/compositor_frame.h"
+#include "content/browser/aura/browser_compositor_output_surface_capturer.h"
#include "content/browser/aura/reflector_impl.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
@@ -22,7 +23,7 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface(
const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
int surface_id,
IDMap<BrowserCompositorOutputSurface>* output_surface_map,
- base::MessageLoopProxy* compositor_message_loop,
+ const scoped_refptr<base::MessageLoopProxy>& compositor_message_loop,
base::WeakPtr<ui::Compositor> compositor)
: OutputSurface(context_provider),
surface_id_(surface_id),
@@ -48,6 +49,10 @@ BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() {
if (!HasClient())
return;
output_surface_map_->Remove(surface_id_);
+ // Don't delete the actual object; we don't own it.
+ FOR_EACH_OBSERVER(BrowserCompositorOutputSurfaceCapturer,
+ capturer_list_,
+ DoDestroyOnImplThread());
}
bool BrowserCompositorOutputSurface::BindToClient(
@@ -80,6 +85,10 @@ void BrowserCompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
context_provider_->Context3d()->shallowFlushCHROMIUM();
command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info);
+ FOR_EACH_OBSERVER(BrowserCompositorOutputSurfaceCapturer,
+ capturer_list_,
+ NotifySwapBuffersOnImplThread());
+
if (reflector_.get()) {
if (frame->gl_frame_data->sub_buffer_rect ==
gfx::Rect(frame->gl_frame_data->size))
@@ -107,4 +116,16 @@ void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) {
reflector_ = reflector;
}
+void BrowserCompositorOutputSurface::AddCapturer(
+ BrowserCompositorOutputSurfaceCapturer* capturer) {
+ DCHECK(CalledOnValidThread());
+ capturer_list_.AddObserver(capturer);
+}
+
+void BrowserCompositorOutputSurface::RemoveCapturer(
+ BrowserCompositorOutputSurfaceCapturer* capturer) {
+ DCHECK(CalledOnValidThread());
+ capturer_list_.RemoveObserver(capturer);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698