| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/OffscreenCanvasPlaceholder.h" | 5 #include "platform/graphics/OffscreenCanvasPlaceholder.h" |
| 6 | 6 |
| 7 #include "platform/CrossThreadFunctional.h" | 7 #include "platform/CrossThreadFunctional.h" |
| 8 #include "platform/WebTaskRunner.h" | 8 #include "platform/WebTaskRunner.h" |
| 9 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" | 9 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" |
| 10 #include "platform/graphics/StaticBitmapImage.h" | 10 #include "platform/graphics/StaticBitmapImage.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 unsigned placeholderId) { | 42 unsigned placeholderId) { |
| 43 PlaceholderIdMap::iterator it = placeholderRegistry().find(placeholderId); | 43 PlaceholderIdMap::iterator it = placeholderRegistry().find(placeholderId); |
| 44 if (it == placeholderRegistry().end()) | 44 if (it == placeholderRegistry().end()) |
| 45 return nullptr; | 45 return nullptr; |
| 46 return it->value; | 46 return it->value; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void OffscreenCanvasPlaceholder::registerPlaceholder(unsigned placeholderId) { | 49 void OffscreenCanvasPlaceholder::registerPlaceholder(unsigned placeholderId) { |
| 50 DCHECK(!placeholderRegistry().contains(placeholderId)); | 50 DCHECK(!placeholderRegistry().contains(placeholderId)); |
| 51 DCHECK(!isPlaceholderRegistered()); | 51 DCHECK(!isPlaceholderRegistered()); |
| 52 placeholderRegistry().add(placeholderId, this); | 52 placeholderRegistry().insert(placeholderId, this); |
| 53 m_placeholderId = placeholderId; | 53 m_placeholderId = placeholderId; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void OffscreenCanvasPlaceholder::unregisterPlaceholder() { | 56 void OffscreenCanvasPlaceholder::unregisterPlaceholder() { |
| 57 if (!isPlaceholderRegistered()) | 57 if (!isPlaceholderRegistered()) |
| 58 return; | 58 return; |
| 59 DCHECK(placeholderRegistry().find(m_placeholderId)->value == this); | 59 DCHECK(placeholderRegistry().find(m_placeholderId)->value == this); |
| 60 placeholderRegistry().erase(m_placeholderId); | 60 placeholderRegistry().erase(m_placeholderId); |
| 61 m_placeholderId = kNoPlaceholderId; | 61 m_placeholderId = kNoPlaceholderId; |
| 62 } | 62 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 m_placeholderFrame->transfer(); | 81 m_placeholderFrame->transfer(); |
| 82 m_frameDispatcherTaskRunner->postTask( | 82 m_frameDispatcherTaskRunner->postTask( |
| 83 BLINK_FROM_HERE, | 83 BLINK_FROM_HERE, |
| 84 crossThreadBind(releaseFrameToDispatcher, std::move(m_frameDispatcher), | 84 crossThreadBind(releaseFrameToDispatcher, std::move(m_frameDispatcher), |
| 85 std::move(m_placeholderFrame), | 85 std::move(m_placeholderFrame), |
| 86 m_placeholderFrameResourceId)); | 86 m_placeholderFrameResourceId)); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // blink | 90 } // blink |
| OLD | NEW |