Chromium Code Reviews| Index: cc/ganesh_resource_provider.cc |
| diff --git a/cc/ganesh_resource_provider.cc b/cc/ganesh_resource_provider.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3617a4a9696a2a81e3e798db11aafc2f4e28c1bd |
| --- /dev/null |
| +++ b/cc/ganesh_resource_provider.cc |
| @@ -0,0 +1,43 @@ |
| +// 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/ganesh_resource_provider.h" |
| + |
| +#include "cc/resource_provider.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" |
| +#include "third_party/skia/include/gpu/GrContext.h" |
| + |
| +namespace cc { |
| + |
| +GaneshResourceProvider::GaneshResourceProvider() |
| + : context3d_(NULL), |
| + gr_context_(NULL) { |
| +} |
| + |
| +GaneshResourceProvider::~GaneshResourceProvider() {} |
| + |
| +GaneshResourceProvider::ScopedContexts::ScopedContexts( |
| + GaneshResourceProvider* ganesh_resource_provider) |
| + : ganesh_resource_provider_(ganesh_resource_provider) { |
| +} |
| + |
| +GaneshResourceProvider::ScopedContexts::~ScopedContexts() {} |
| + |
| +GaneshResourceProvider::ScopedContextsFlushed::ScopedContextsFlushed( |
| + ResourceProvider* resource_provider, |
| + GaneshResourceProvider* ganesh_resource_provider) |
| + : ScopedContexts(ganesh_resource_provider) { |
| + resource_provider->flush(); |
| +} |
| + |
| +GaneshResourceProvider::ScopedContextsFlushed::~ScopedContextsFlushed() { |
| + // Flush ganesh context so that all the rendered stuff appears on the |
| + // texture. |
| + if (gr_context()) gr_context()->flush(); |
|
piman
2013/02/11 18:45:33
nit: statement goes onto next line.
danakj
2013/02/11 18:58:13
Done.
|
| + // Flush the GL context so rendering results from this context are |
| + // visible in the compositor's context. |
| + if (context3d()) context3d()->flush(); |
|
piman
2013/02/11 18:45:33
nit: statement goes onto next line.
danakj
2013/02/11 18:58:13
Done.
|
| +} |
| + |
| +} // namespace cc |