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

Unified Diff: webkit/support/test_webkit_platform_support.cc

Issue 12217099: Implement the Platform::sharedOffscreenGraphicsContext3D method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop was_created Created 7 years, 10 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: webkit/support/test_webkit_platform_support.cc
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index b61c701853de30538d24ee4f878aaa0260c871cd..23c36fc6e26a7d4b6295c09e171137538b33a80f 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -11,6 +11,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "cc/context_provider.h"
#include "cc/thread_impl.h"
#include "media/base/media.h"
#include "net/cookies/cookie_monster.h"
@@ -40,6 +41,7 @@
#include "webkit/glue/webclipboard_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webkitplatformsupport_impl.h"
+#include "webkit/gpu/test_context_provider_factory.h"
#include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
#include "webkit/plugins/npapi/plugin_list.h"
@@ -73,7 +75,8 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode,
WebKit::Platform* shadow_platform_delegate)
: unit_test_mode_(unit_test_mode),
shadow_platform_delegate_(shadow_platform_delegate),
- hyphen_dictionary_(NULL) {
+ hyphen_dictionary_(NULL),
+ context_provider_factory_(NULL) {
v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
WebKit::initialize(this);
@@ -157,6 +160,8 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode,
TestWebKitPlatformSupport::~TestWebKitPlatformSupport() {
if (hyphen_dictionary_)
hnj_hyphen_free(hyphen_dictionary_);
+ if (context_provider_factory_)
+ webkit::gpu::TestContextProviderFactory::DestroyInstance();
}
WebKit::WebMimeRegistry* TestWebKitPlatformSupport::mimeRegistry() {
@@ -377,6 +382,28 @@ TestWebKitPlatformSupport::createOffscreenGraphicsContext3D(
return NULL;
}
+WebKit::WebGraphicsContext3D*
+TestWebKitPlatformSupport::sharedOffscreenGraphicsContext3D() {
+ if (!context_provider_factory_) {
+ context_provider_factory_ =
+ webkit::gpu::TestContextProviderFactory::GetInstance();
+ }
+
+ main_thread_contexts_ =
+ context_provider_factory_->OffscreenContextProviderForMainThread();
+ if (!main_thread_contexts_->InitializeOnMainThread())
+ return NULL;
+ if (!main_thread_contexts_->BindToCurrentThread())
+ return NULL;
+ return main_thread_contexts_->Context3d();
+}
+
+GrContext* TestWebKitPlatformSupport::sharedOffscreenGrContext() {
+ if (!main_thread_contexts_)
+ return NULL;
+ return main_thread_contexts_->GrContext();
+}
+
bool TestWebKitPlatformSupport::canAccelerate2dCanvas() {
// We supply an OS-MESA based context for accelarated 2d
// canvas, which should always work.

Powered by Google App Engine
This is Rietveld 408576698