| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 class SharedGraphicsContext3DImpl { | 36 class SharedGraphicsContext3DImpl { |
| 37 public: | 37 public: |
| 38 SharedGraphicsContext3DImpl() : m_context(0) { } | 38 SharedGraphicsContext3DImpl() : m_context(0) { } |
| 39 PassRefPtr<GraphicsContext3D> getOrCreateContext() | 39 PassRefPtr<GraphicsContext3D> getOrCreateContext() |
| 40 { | 40 { |
| 41 // If we lost the context, or can't make it current, create a new one. | 41 // If we lost the context, or can't make it current, create a new one. |
| 42 if (m_context && (!m_context->makeContextCurrent() || (m_context->getExt
ensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR))) | 42 if (m_context && (!m_context->makeContextCurrent() || (m_context->getExt
ensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR))) |
| 43 m_context.clear(); | 43 m_context.clear(); |
| 44 | 44 |
| 45 if (!m_context) | 45 bool wasCreated = false; |
| 46 |
| 47 if (!m_context) { |
| 46 createContext(); | 48 createContext(); |
| 49 wasCreated = true; |
| 50 } |
| 47 | 51 |
| 48 if (m_context && !m_context->makeContextCurrent()) | 52 if (m_context && !m_context->makeContextCurrent()) |
| 49 m_context.clear(); | 53 m_context.clear(); |
| 50 | 54 |
| 55 if (m_context && wasCreated) |
| 56 m_context->getExtensions()->pushGroupMarkerEXT("SharedGraphicsContex
t"); |
| 57 |
| 51 return m_context; | 58 return m_context; |
| 52 } | 59 } |
| 53 | 60 |
| 54 PassRefPtr<GraphicsContext3D> getContext() | 61 PassRefPtr<GraphicsContext3D> getContext() |
| 55 { | 62 { |
| 56 return m_context; | 63 return m_context; |
| 57 } | 64 } |
| 58 | 65 |
| 59 PassRefPtr<GraphicsContext3D> createContext() | 66 PassRefPtr<GraphicsContext3D> createContext() |
| 60 { | 67 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 107 } |
| 101 | 108 |
| 102 bool SharedGraphicsContext3D::createForImplThread() | 109 bool SharedGraphicsContext3D::createForImplThread() |
| 103 { | 110 { |
| 104 ASSERT(isMainThread()); | 111 ASSERT(isMainThread()); |
| 105 return getOrCreateContextForImplThread(Create); | 112 return getOrCreateContextForImplThread(Create); |
| 106 } | 113 } |
| 107 | 114 |
| 108 } | 115 } |
| 109 | 116 |
| OLD | NEW |