OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_resource_tracker.h" | 5 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "third_party/ppapi/c/pp_resource.h" | 10 #include "third_party/ppapi/c/pp_resource.h" |
11 #include "webkit/glue/plugins/pepper_buffer.h" | 11 #include "webkit/glue/plugins/pepper_buffer.h" |
12 #include "webkit/glue/plugins/pepper_device_context_2d.h" | 12 #include "webkit/glue/plugins/pepper_device_context_2d.h" |
13 #include "webkit/glue/plugins/pepper_image_data.h" | 13 #include "webkit/glue/plugins/pepper_image_data.h" |
14 #include "webkit/glue/plugins/pepper_resource.h" | 14 #include "webkit/glue/plugins/pepper_resource.h" |
| 15 #include "webkit/glue/plugins/pepper_url_loader.h" |
| 16 #include "webkit/glue/plugins/pepper_url_request_info.h" |
| 17 #include "webkit/glue/plugins/pepper_url_response_info.h" |
15 | 18 |
16 namespace pepper { | 19 namespace pepper { |
17 | 20 |
18 ResourceTracker::ResourceTracker() { | 21 ResourceTracker::ResourceTracker() { |
19 } | 22 } |
20 | 23 |
21 ResourceTracker::~ResourceTracker() { | 24 ResourceTracker::~ResourceTracker() { |
22 } | 25 } |
23 | 26 |
24 // static | 27 // static |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 62 } |
60 | 63 |
61 scoped_refptr<ImageData> ResourceTracker::GetAsImageData( | 64 scoped_refptr<ImageData> ResourceTracker::GetAsImageData( |
62 PP_Resource res) const { | 65 PP_Resource res) const { |
63 scoped_refptr<Resource> resource = GetResource(res); | 66 scoped_refptr<Resource> resource = GetResource(res); |
64 if (!resource.get()) | 67 if (!resource.get()) |
65 return scoped_refptr<ImageData>(); | 68 return scoped_refptr<ImageData>(); |
66 return scoped_refptr<ImageData>(resource->AsImageData()); | 69 return scoped_refptr<ImageData>(resource->AsImageData()); |
67 } | 70 } |
68 | 71 |
| 72 scoped_refptr<URLLoader> ResourceTracker::GetAsURLLoader( |
| 73 PP_Resource res) const { |
| 74 scoped_refptr<Resource> resource = GetResource(res); |
| 75 if (!resource.get()) |
| 76 return scoped_refptr<URLLoader>(); |
| 77 return scoped_refptr<URLLoader>(resource->AsURLLoader()); |
| 78 } |
| 79 |
| 80 scoped_refptr<URLRequestInfo> ResourceTracker::GetAsURLRequestInfo( |
| 81 PP_Resource res) const { |
| 82 scoped_refptr<Resource> resource = GetResource(res); |
| 83 if (!resource.get()) |
| 84 return scoped_refptr<URLRequestInfo>(); |
| 85 return scoped_refptr<URLRequestInfo>(resource->AsURLRequestInfo()); |
| 86 } |
| 87 |
| 88 scoped_refptr<URLResponseInfo> ResourceTracker::GetAsURLResponseInfo( |
| 89 PP_Resource res) const { |
| 90 scoped_refptr<Resource> resource = GetResource(res); |
| 91 if (!resource.get()) |
| 92 return scoped_refptr<URLResponseInfo>(); |
| 93 return scoped_refptr<URLResponseInfo>(resource->AsURLResponseInfo()); |
| 94 } |
| 95 |
69 scoped_refptr<Buffer> ResourceTracker::GetAsBuffer( | 96 scoped_refptr<Buffer> ResourceTracker::GetAsBuffer( |
70 PP_Resource res) const { | 97 PP_Resource res) const { |
71 scoped_refptr<Resource> resource = GetResource(res); | 98 scoped_refptr<Resource> resource = GetResource(res); |
72 if (!resource.get()) | 99 if (!resource.get()) |
73 return scoped_refptr<Buffer>(); | 100 return scoped_refptr<Buffer>(); |
74 return scoped_refptr<Buffer>(resource->AsBuffer()); | 101 return scoped_refptr<Buffer>(resource->AsBuffer()); |
75 } | 102 } |
76 | 103 |
77 } // namespace pepper | 104 } // namespace pepper |
OLD | NEW |