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

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

Issue 1925583003: Replace AllowCrossThreadAccess() + non-GCed pointers with crossThreadUnretained() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4
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 537 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, AllowCrossThreadAccess(&creationInfo), AllowCrossThreadAccess(&wait ableEvent))); 558 taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&createContextProviderO nMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waitab leEvent)));
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 5855 matching lines...) Expand 10 before | Expand all | Expand 10 after
6424 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6424 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6425 } 6425 }
6426 6426
6427 void WebGLRenderingContextBase::restoreUnpackParameters() 6427 void WebGLRenderingContextBase::restoreUnpackParameters()
6428 { 6428 {
6429 if (m_unpackAlignment != 1) 6429 if (m_unpackAlignment != 1)
6430 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6430 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6431 } 6431 }
6432 6432
6433 } // namespace blink 6433 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698