OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/plugins/ppapi/host_globals.h" | 5 #include "webkit/plugins/ppapi/host_globals.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "ppapi/shared_impl/api_id.h" | 13 #include "ppapi/shared_impl/api_id.h" |
14 #include "ppapi/shared_impl/id_assignment.h" | 14 #include "ppapi/shared_impl/id_assignment.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
21 #include "webkit/plugins/plugin_switches.h" | 21 #include "webkit/plugins/plugin_switches.h" |
22 #include "webkit/plugins/ppapi/plugin_module.h" | 22 #include "webkit/plugins/ppapi/plugin_module.h" |
23 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 23 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
24 | 24 |
25 using ppapi::CheckIdType; | 25 using ppapi::CheckIdType; |
26 using ppapi::MakeTypedId; | 26 using ppapi::MakeTypedId; |
27 using ppapi::PPIdType; | 27 using ppapi::PPIdType; |
| 28 using ppapi::ResourceTracker; |
28 using WebKit::WebConsoleMessage; | 29 using WebKit::WebConsoleMessage; |
29 using WebKit::WebString; | 30 using WebKit::WebString; |
30 | 31 |
31 namespace webkit { | 32 namespace webkit { |
32 namespace ppapi { | 33 namespace ppapi { |
33 | 34 |
34 namespace { | 35 namespace { |
35 | 36 |
36 typedef std::set<WebKit::WebPluginContainer*> ContainerSet; | 37 typedef std::set<WebKit::WebPluginContainer*> ContainerSet; |
37 | 38 |
(...skipping 29 matching lines...) Expand all Loading... |
67 result.append(": "); | 68 result.append(": "); |
68 result.append(message); | 69 result.append(message); |
69 return WebConsoleMessage(LogLevelToWebLogLevel(level), | 70 return WebConsoleMessage(LogLevelToWebLogLevel(level), |
70 WebString(UTF8ToUTF16(result))); | 71 WebString(UTF8ToUTF16(result))); |
71 } | 72 } |
72 | 73 |
73 } // namespace | 74 } // namespace |
74 | 75 |
75 HostGlobals* HostGlobals::host_globals_ = NULL; | 76 HostGlobals* HostGlobals::host_globals_ = NULL; |
76 | 77 |
77 HostGlobals::HostGlobals() : ::ppapi::PpapiGlobals() { | 78 HostGlobals::HostGlobals() |
| 79 : ::ppapi::PpapiGlobals(), |
| 80 resource_tracker_(ResourceTracker::SINGLE_THREADED) { |
78 DCHECK(!host_globals_); | 81 DCHECK(!host_globals_); |
79 host_globals_ = this; | 82 host_globals_ = this; |
80 } | 83 } |
81 | 84 |
82 HostGlobals::HostGlobals( | 85 HostGlobals::HostGlobals( |
83 ::ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test) | 86 ::ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test) |
84 : ::ppapi::PpapiGlobals(per_thread_for_test) { | 87 : ::ppapi::PpapiGlobals(per_thread_for_test), |
| 88 resource_tracker_(ResourceTracker::SINGLE_THREADED) { |
85 DCHECK(!host_globals_); | 89 DCHECK(!host_globals_); |
86 } | 90 } |
87 | 91 |
88 HostGlobals::~HostGlobals() { | 92 HostGlobals::~HostGlobals() { |
89 DCHECK(host_globals_ == this || !host_globals_); | 93 DCHECK(host_globals_ == this || !host_globals_); |
90 host_globals_ = NULL; | 94 host_globals_ = NULL; |
91 } | 95 } |
92 | 96 |
93 ::ppapi::ResourceTracker* HostGlobals::GetResourceTracker() { | 97 ::ppapi::ResourceTracker* HostGlobals::GetResourceTracker() { |
94 return &resource_tracker_; | 98 return &resource_tracker_; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return NULL; | 266 return NULL; |
263 return found->second; | 267 return found->second; |
264 } | 268 } |
265 | 269 |
266 bool HostGlobals::IsHostGlobals() const { | 270 bool HostGlobals::IsHostGlobals() const { |
267 return true; | 271 return true; |
268 } | 272 } |
269 | 273 |
270 } // namespace ppapi | 274 } // namespace ppapi |
271 } // namespace webkit | 275 } // namespace webkit |
OLD | NEW |