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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2104913002: Rename threadSafeBind() to crossThreadBind() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_CTCPointer
Patch Set: Rebase Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "modules/webgl/WebGLFramebuffer.h" 76 #include "modules/webgl/WebGLFramebuffer.h"
77 #include "modules/webgl/WebGLLoseContext.h" 77 #include "modules/webgl/WebGLLoseContext.h"
78 #include "modules/webgl/WebGLProgram.h" 78 #include "modules/webgl/WebGLProgram.h"
79 #include "modules/webgl/WebGLRenderbuffer.h" 79 #include "modules/webgl/WebGLRenderbuffer.h"
80 #include "modules/webgl/WebGLShader.h" 80 #include "modules/webgl/WebGLShader.h"
81 #include "modules/webgl/WebGLShaderPrecisionFormat.h" 81 #include "modules/webgl/WebGLShaderPrecisionFormat.h"
82 #include "modules/webgl/WebGLUniformLocation.h" 82 #include "modules/webgl/WebGLUniformLocation.h"
83 #include "modules/webgl/WebGLVertexArrayObject.h" 83 #include "modules/webgl/WebGLVertexArrayObject.h"
84 #include "modules/webgl/WebGLVertexArrayObjectOES.h" 84 #include "modules/webgl/WebGLVertexArrayObjectOES.h"
85 #include "platform/CheckedInt.h" 85 #include "platform/CheckedInt.h"
86 #include "platform/CrossThreadFunctional.h"
86 #include "platform/RuntimeEnabledFeatures.h" 87 #include "platform/RuntimeEnabledFeatures.h"
87 #include "platform/ThreadSafeFunctional.h"
88 #include "platform/WaitableEvent.h" 88 #include "platform/WaitableEvent.h"
89 #include "platform/geometry/IntSize.h" 89 #include "platform/geometry/IntSize.h"
90 #include "platform/graphics/GraphicsContext.h" 90 #include "platform/graphics/GraphicsContext.h"
91 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 91 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
92 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" 92 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h"
93 #include "public/platform/Platform.h" 93 #include "public/platform/Platform.h"
94 #include "public/platform/functional/WebFunction.h" 94 #include "public/platform/functional/WebFunction.h"
95 #include "wtf/Functional.h" 95 #include "wtf/Functional.h"
96 #include "wtf/PtrUtil.h" 96 #include "wtf/PtrUtil.h"
97 #include "wtf/text/StringBuilder.h" 97 #include "wtf/text/StringBuilder.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 549
550 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderOnWork erThread(Platform::ContextAttributes contextAttributes, Platform::GraphicsInfo* glInfo, ScriptState* scriptState) 550 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderOnWork erThread(Platform::ContextAttributes contextAttributes, Platform::GraphicsInfo* glInfo, ScriptState* scriptState)
551 { 551 {
552 WaitableEvent waitableEvent; 552 WaitableEvent waitableEvent;
553 ContextProviderCreationInfo creationInfo; 553 ContextProviderCreationInfo creationInfo;
554 creationInfo.contextAttributes = contextAttributes; 554 creationInfo.contextAttributes = contextAttributes;
555 creationInfo.glInfo = glInfo; 555 creationInfo.glInfo = glInfo;
556 creationInfo.scriptState = scriptState; 556 creationInfo.scriptState = scriptState;
557 WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRun ner(); 557 WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRun ner();
558 taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&createContextProviderO nMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waitab leEvent))); 558 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&createContextProvider OnMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waita bleEvent)));
559 waitableEvent.wait(); 559 waitableEvent.wait();
560 return std::move(creationInfo.createdContextProvider); 560 return std::move(creationInfo.createdContextProvider);
561 } 561 }
562 562
563 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createC ontextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebG LContextAttributes attributes, unsigned webGLVersion) 563 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createC ontextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebG LContextAttributes attributes, unsigned webGLVersion)
564 { 564 {
565 // Exactly one of these must be provided. 565 // Exactly one of these must be provided.
566 DCHECK_EQ(!canvas, !!scriptState); 566 DCHECK_EQ(!canvas, !!scriptState);
567 // The canvas is only given on the main thread. 567 // The canvas is only given on the main thread.
568 DCHECK(!canvas || isMainThread()); 568 DCHECK(!canvas || isMainThread());
(...skipping 5875 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6444 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6445 } 6445 }
6446 6446
6447 void WebGLRenderingContextBase::restoreUnpackParameters() 6447 void WebGLRenderingContextBase::restoreUnpackParameters()
6448 { 6448 {
6449 if (m_unpackAlignment != 1) 6449 if (m_unpackAlignment != 1)
6450 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6450 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6451 } 6451 }
6452 6452
6453 } // namespace blink 6453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698