| Index: cc/grcontext_provider.cc
|
| diff --git a/cc/grcontext_provider.cc b/cc/grcontext_provider.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8b7ea7647272ed96afef437ceee0a8fbdee651a8
|
| --- /dev/null
|
| +++ b/cc/grcontext_provider.cc
|
| @@ -0,0 +1,42 @@
|
| +// 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/grcontext_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 {
|
| +
|
| +GrContextProvider::GrContextProvider(ResourceProvider* resource_provider)
|
| + : resource_provider_(resource_provider),
|
| + context3d_(NULL),
|
| + gr_context_(NULL) {
|
| +}
|
| +
|
| +GrContextProvider::~GrContextProvider() {}
|
| +
|
| +void GrContextProvider::BeginUsingContexts() {
|
| + // Flush the compositor context to ensure that textures there are available
|
| + // in the shared context.
|
| + resource_provider_->flush();
|
| +
|
| + // Make sure ganesh uses the correct GL context.
|
| + if (context3d())
|
| + context3d()->makeContextCurrent();
|
| +}
|
| +
|
| +void GrContextProvider::FinishUsingContexts() {
|
| + // Flush ganesh context so that all the rendered stuff appears on the
|
| + // texture.
|
| + if (gr_context())
|
| + gr_context()->flush();
|
| + // Flush the GL context so rendering results from this context are
|
| + // visible in the compositor's context.
|
| + if (context3d())
|
| + context3d()->flush();
|
| +}
|
| +
|
| +} // namespace cc
|
|
|