Index: content/browser/android/in_process/synchronous_compositor_output_surface.cc |
diff --git a/content/renderer/android/synchronous_compositor_output_surface.cc b/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
similarity index 90% |
rename from content/renderer/android/synchronous_compositor_output_surface.cc |
rename to content/browser/android/in_process/synchronous_compositor_output_surface.cc |
index ed367d9acc8f62f094f4b895e47451ea41475923..db5b2ebde55c2c0428b89324923357583444e559 100644 |
--- a/content/renderer/android/synchronous_compositor_output_surface.cc |
+++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "content/renderer/android/synchronous_compositor_output_surface.h" |
+#include "content/browser/android/in_process/synchronous_compositor_output_surface.h" |
#include "base/command_line.h" |
#include "base/logging.h" |
@@ -12,9 +12,9 @@ |
#include "cc/output/output_surface_client.h" |
#include "cc/output/software_output_device.h" |
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
+#include "content/public/browser/browser_thread.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/renderer/android/synchronous_compositor_client.h" |
-#include "content/public/renderer/content_renderer_client.h" |
#include "skia/ext/refptr.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
#include "third_party/skia/include/core/SkDevice.h" |
@@ -87,11 +87,12 @@ class SynchronousCompositorOutputSurface::SoftwareDevice |
}; |
SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( |
- SynchronousCompositorOutputSurfaceDelegate* delegate) |
+ int routing_id) |
: cc::OutputSurface( |
CreateWebGraphicsContext3D(), |
scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), |
- delegate_(delegate), |
+ routing_id_(routing_id), |
+ delegate_(NULL), |
needs_begin_frame_(false), |
did_swap_buffer_(false), |
current_sw_canvas_(NULL) { |
@@ -100,7 +101,8 @@ SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( |
SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() { |
DCHECK(CalledOnValidThread()); |
- delegate_->DidDestroySynchronousOutputSurface(); |
+ if (delegate_) |
+ delegate_->DidDestroySynchronousOutputSurface(); |
joth
2013/05/29 06:05:10
pass |this| for consistency with the DidBindOutput
mkosiba (inactive)
2013/05/29 15:31:58
sounds like a good idea. we can add a DCHECK to ch
joth
2013/05/29 20:19:08
Done.
|
} |
bool SynchronousCompositorOutputSurface::ForcedDrawToSoftwareDevice() const { |
@@ -112,7 +114,10 @@ bool SynchronousCompositorOutputSurface::BindToClient( |
DCHECK(CalledOnValidThread()); |
if (!cc::OutputSurface::BindToClient(surface_client)) |
return false; |
- delegate_->DidCreateSynchronousOutputSurface(); |
+ // TODO(joth): The SynchronousCompositorOutputSurfaceDelegate is fairly |
+ // pointless if we're statically calling out to SynchronousCompositorImpl |
+ // here. |
joth
2013/05/29 06:05:10
My current thinking is to delete the SynchronousCo
mkosiba (inactive)
2013/05/29 15:31:58
Umm.. SynchronousCompositorImpl will end up contai
joth
2013/05/29 20:19:08
Done.
|
+ SynchronousCompositorImpl::DidBindOutputSurface(routing_id_, this); |
joth
2013/05/29 06:05:10
this could be
SynchronousCompositorImpl::FromRout
joth
2013/05/29 20:19:08
(obsolete)
|
return true; |
} |
@@ -131,7 +136,8 @@ void SynchronousCompositorOutputSurface::SetNeedsBeginFrame( |
bool enable) { |
DCHECK(CalledOnValidThread()); |
needs_begin_frame_ = enable; |
- delegate_->SetContinuousInvalidate(needs_begin_frame_); |
+ if (delegate_) |
+ delegate_->SetContinuousInvalidate(needs_begin_frame_); |
} |
void SynchronousCompositorOutputSurface::SwapBuffers( |
@@ -193,12 +199,10 @@ void SynchronousCompositorOutputSurface::InvokeComposite( |
} |
// Not using base::NonThreadSafe as we want to enforce a more exacting threading |
-// requirement: SynchronousCompositorOutputSurface() must only be used by |
-// embedders that supply their own compositor loop via |
-// OverrideCompositorMessageLoop(). |
+// requirement: SynchronousCompositorOutputSurface() must only be used on the UI |
+// thread. |
bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
- return base::MessageLoop::current() && (base::MessageLoop::current() == |
- GetContentClient()->renderer()->OverrideCompositorMessageLoop()); |
+ return BrowserThread::CurrentlyOn(BrowserThread::UI); |
} |
} // namespace content |