WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-117238-20130605031010.patch (text/plain), 3.47 KB, created by
Jae Hyun Park
on 2013-06-05 03:11:02 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jae Hyun Park
Created:
2013-06-05 03:11:02 PDT
Size:
3.47 KB
patch
obsolete
>Subversion Revision: 151202 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0c9402bece636ac03e39296dbe1004bb9451396a..26fcddb567e56c3870fb0d6a3cd1e963e2f0b1de 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2013-06-05 Jae Hyun Park <jae.park@company100.net> >+ >+ [GTK] Support using GLContext from multiple threads >+ https://bugs.webkit.org/show_bug.cgi?id=117238 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Current implementation assumes that GLContext is only used in the main thread. >+ However, to support using GLContext from multiple threads, we need to change it >+ to thread local. Therefore, ASSERT(isMainThread()) is removed and GLContext is >+ changed to thread local. >+ >+ * platform/graphics/cairo/GLContext.cpp: >+ (WebCore::ThreadGlobalGLContext::setContext): >+ (WebCore::ThreadGlobalGLContext::context): >+ (WebCore::currentContext): >+ (WebCore::GLContext::sharingContext): >+ (WebCore::GLContext::~GLContext): >+ (WebCore::GLContext::makeContextCurrent): >+ (WebCore::GLContext::getCurrent): >+ > 2013-06-05 Mihnea Ovidenie <mihnea@adobe.com> > > [CSS Regions] REGRESSION Incorrect layer clipping inside flow thread >diff --git a/Source/WebCore/platform/graphics/cairo/GLContext.cpp b/Source/WebCore/platform/graphics/cairo/GLContext.cpp >index 7855d8e96799814acb5a8d25db8b704502103425..81c21c729d0ba59c3f920cd0be63bf30b7b2e3d3 100644 >--- a/Source/WebCore/platform/graphics/cairo/GLContext.cpp >+++ b/Source/WebCore/platform/graphics/cairo/GLContext.cpp >@@ -23,7 +23,7 @@ > > #include "GLContextEGL.h" > #include "GLContextGLX.h" >-#include <wtf/MainThread.h> >+#include <wtf/ThreadSpecific.h> > > #if PLATFORM(X11) > #include <X11/Xlib.h> >@@ -38,11 +38,32 @@ > #endif > #endif > >+using WTF::ThreadSpecific; >+ > namespace WebCore { > >+class ThreadGlobalGLContext { >+public: >+ static ThreadSpecific<ThreadGlobalGLContext>* staticGLContext; >+ >+ void setContext(GLContext* context) { m_context = context; } >+ GLContext* context() { return m_context; } >+ >+private: >+ GLContext* m_context; >+}; >+ >+ThreadSpecific<ThreadGlobalGLContext>* ThreadGlobalGLContext::staticGLContext; >+ >+inline ThreadGlobalGLContext* currentContext() >+{ >+ if (!ThreadGlobalGLContext::staticGLContext) >+ ThreadGlobalGLContext::staticGLContext = new ThreadSpecific<ThreadGlobalGLContext>; >+ return *ThreadGlobalGLContext::staticGLContext; >+} >+ > GLContext* GLContext::sharingContext() > { >- ASSERT(isMainThread()); > DEFINE_STATIC_LOCAL(OwnPtr<GLContext>, sharing, (createOffscreenContext())); > return sharing.get(); > } >@@ -153,28 +174,22 @@ PassOwnPtr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContex > return createContextForWindow(0, sharingContext); > } > >-// FIXME: This should be a thread local eventually if we >-// want to support using GLContexts from multiple threads. >-static GLContext* gCurrentContext = 0; >- > GLContext::~GLContext() > { >- if (this == gCurrentContext) >- gCurrentContext = 0; >+ if (this == currentContext()->context()) >+ currentContext()->setContext(0); > removeActiveContext(this); > } > > bool GLContext::makeContextCurrent() > { >- ASSERT(isMainThread()); >- gCurrentContext = this; >+ currentContext()->setContext(this); > return true; > } > > GLContext* GLContext::getCurrent() > { >- ASSERT(isMainThread()); >- return gCurrentContext; >+ return currentContext()->context(); > } > > } // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 117238
: 203781