| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "android_webview/common/renderer_picture_map.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 | |
| 9 using base::AutoLock; | |
| 10 | |
| 11 namespace android_webview { | |
| 12 | |
| 13 static RendererPictureMap* g_renderer_picture_map = NULL; | |
| 14 | |
| 15 // static | |
| 16 void RendererPictureMap::CreateInstance() { | |
| 17 if (!g_renderer_picture_map) | |
| 18 g_renderer_picture_map = new RendererPictureMap(); | |
| 19 } | |
| 20 | |
| 21 // static | |
| 22 RendererPictureMap* RendererPictureMap::GetInstance() { | |
| 23 DCHECK(g_renderer_picture_map); | |
| 24 return g_renderer_picture_map; | |
| 25 } | |
| 26 | |
| 27 RendererPictureMap::RendererPictureMap() { | |
| 28 } | |
| 29 | |
| 30 RendererPictureMap::~RendererPictureMap() { | |
| 31 } | |
| 32 | |
| 33 skia::RefPtr<SkPicture> RendererPictureMap::GetRendererPicture(int id) { | |
| 34 AutoLock lock(lock_); | |
| 35 return picture_map_[id]; | |
| 36 } | |
| 37 | |
| 38 void RendererPictureMap::SetRendererPicture(int id, | |
| 39 skia::RefPtr<SkPicture> picture) { | |
| 40 AutoLock lock(lock_); | |
| 41 picture_map_[id] = picture; | |
| 42 } | |
| 43 | |
| 44 void RendererPictureMap::ClearRendererPicture(int id) { | |
| 45 AutoLock lock(lock_); | |
| 46 picture_map_.erase(id); | |
| 47 } | |
| 48 | |
| 49 } // android_webview | |
| OLD | NEW |