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

Unified Diff: ui/compositor/compositor.cc

Issue 21026005: aura: Remove CreateOffscreenContext from ui::ContextFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: offscreencontext: rebase Created 7 years, 5 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
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index c804e8d060c8842d00bcd26564895c053a16e7b2..5727649e032377c37f37454636438abebcc007ca 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -16,6 +16,7 @@
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "cc/base/switches.h"
+#include "cc/debug/fake_context_provider.h"
#include "cc/input/input_handler.h"
#include "cc/layers/layer.h"
#include "cc/output/context_provider.h"
@@ -24,7 +25,6 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/compositor/compositor_observer.h"
#include "ui/compositor/compositor_switches.h"
-#include "ui/compositor/context_provider_from_context_factory.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/reflector.h"
@@ -139,11 +139,6 @@ scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface(
CreateContextCommon(compositor, false)));
}
-scoped_ptr<WebKit::WebGraphicsContext3D>
-DefaultContextFactory::CreateOffscreenContext() {
- return CreateContextCommon(NULL, true);
-}
-
scoped_refptr<Reflector> DefaultContextFactory::CreateReflector(
Compositor* mirroed_compositor,
Layer* mirroring_layer) {
@@ -158,8 +153,12 @@ scoped_refptr<cc::ContextProvider>
DefaultContextFactory::OffscreenContextProviderForMainThread() {
if (!offscreen_contexts_main_thread_.get() ||
!offscreen_contexts_main_thread_->DestroyedOnMainThread()) {
- offscreen_contexts_main_thread_ =
- ContextProviderFromContextFactory::CreateForOffscreen(this);
+ Compositor* compositor = NULL;
+ bool offscreen = true;
+ offscreen_contexts_main_thread_ = cc::FakeContextProvider::Create(
+ base::Bind(&DefaultContextFactory::CreateContextCommon,
+ compositor,
+ offscreen));
piman 2013/07/30 20:15:10 If we don't make it create the GrContext any more,
danakj 2013/07/30 20:32:08 Oh, this should be the in process ContextProvider
piman 2013/07/30 20:42:02 Yeah, I think that'd work fine. Quite possibly we
if (offscreen_contexts_main_thread_.get() &&
!offscreen_contexts_main_thread_->BindToCurrentThread())
offscreen_contexts_main_thread_ = NULL;
@@ -171,8 +170,12 @@ scoped_refptr<cc::ContextProvider>
DefaultContextFactory::OffscreenContextProviderForCompositorThread() {
if (!offscreen_contexts_compositor_thread_.get() ||
!offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) {
- offscreen_contexts_compositor_thread_ =
- ContextProviderFromContextFactory::CreateForOffscreen(this);
+ Compositor* compositor = NULL;
+ bool offscreen = true;
+ offscreen_contexts_compositor_thread_ = cc::FakeContextProvider::Create(
+ base::Bind(&DefaultContextFactory::CreateContextCommon,
+ compositor,
+ offscreen));
}
return offscreen_contexts_compositor_thread_;
}
@@ -180,6 +183,7 @@ DefaultContextFactory::OffscreenContextProviderForCompositorThread() {
void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
}
+// static
scoped_ptr<WebKit::WebGraphicsContext3D>
DefaultContextFactory::CreateContextCommon(Compositor* compositor,
bool offscreen) {
@@ -207,14 +211,6 @@ scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
return make_scoped_ptr(new cc::OutputSurface(CreateOffscreenContext()));
}
-scoped_ptr<WebKit::WebGraphicsContext3D>
-TestContextFactory::CreateOffscreenContext() {
- scoped_ptr<ui::TestWebGraphicsContext3D> context(
- new ui::TestWebGraphicsContext3D);
- context->Initialize();
- return context.PassAs<WebKit::WebGraphicsContext3D>();
-}
-
scoped_refptr<Reflector> TestContextFactory::CreateReflector(
Compositor* mirrored_compositor,
Layer* mirroring_layer) {
@@ -228,8 +224,8 @@ scoped_refptr<cc::ContextProvider>
TestContextFactory::OffscreenContextProviderForMainThread() {
if (!offscreen_contexts_main_thread_.get() ||
offscreen_contexts_main_thread_->DestroyedOnMainThread()) {
- offscreen_contexts_main_thread_ =
- ContextProviderFromContextFactory::CreateForOffscreen(this);
+ offscreen_contexts_main_thread_ = cc::FakeContextProvider::Create(
+ base::Bind(&TestContextFactory::CreateOffscreenContext));
CHECK(offscreen_contexts_main_thread_->BindToCurrentThread());
}
return offscreen_contexts_main_thread_;
@@ -239,8 +235,8 @@ scoped_refptr<cc::ContextProvider>
TestContextFactory::OffscreenContextProviderForCompositorThread() {
if (!offscreen_contexts_compositor_thread_.get() ||
offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) {
- offscreen_contexts_compositor_thread_ =
- ContextProviderFromContextFactory::CreateForOffscreen(this);
+ offscreen_contexts_compositor_thread_ = cc::FakeContextProvider::Create(
+ base::Bind(&TestContextFactory::CreateOffscreenContext));
}
return offscreen_contexts_compositor_thread_;
}
@@ -248,6 +244,15 @@ TestContextFactory::OffscreenContextProviderForCompositorThread() {
void TestContextFactory::RemoveCompositor(Compositor* compositor) {
}
+// static
+scoped_ptr<WebKit::WebGraphicsContext3D>
+TestContextFactory::CreateOffscreenContext() {
+ scoped_ptr<ui::TestWebGraphicsContext3D> context(
+ new ui::TestWebGraphicsContext3D);
+ context->Initialize();
+ return context.PassAs<WebKit::WebGraphicsContext3D>();
+}
+
Texture::Texture(bool flipped, const gfx::Size& size, float device_scale_factor)
: size_(size),
flipped_(flipped),
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698