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; | |
29 using WebKit::WebConsoleMessage; | 28 using WebKit::WebConsoleMessage; |
30 using WebKit::WebString; | 29 using WebKit::WebString; |
31 | 30 |
32 namespace webkit { | 31 namespace webkit { |
33 namespace ppapi { | 32 namespace ppapi { |
34 | 33 |
35 namespace { | 34 namespace { |
36 | 35 |
37 typedef std::set<WebKit::WebPluginContainer*> ContainerSet; | 36 typedef std::set<WebKit::WebPluginContainer*> ContainerSet; |
38 | 37 |
(...skipping 29 matching lines...) Expand all Loading... |
68 result.append(": "); | 67 result.append(": "); |
69 result.append(message); | 68 result.append(message); |
70 return WebConsoleMessage(LogLevelToWebLogLevel(level), | 69 return WebConsoleMessage(LogLevelToWebLogLevel(level), |
71 WebString(UTF8ToUTF16(result))); | 70 WebString(UTF8ToUTF16(result))); |
72 } | 71 } |
73 | 72 |
74 } // namespace | 73 } // namespace |
75 | 74 |
76 HostGlobals* HostGlobals::host_globals_ = NULL; | 75 HostGlobals* HostGlobals::host_globals_ = NULL; |
77 | 76 |
78 HostGlobals::HostGlobals() | 77 HostGlobals::HostGlobals() : ::ppapi::PpapiGlobals() { |
79 : ::ppapi::PpapiGlobals(), | |
80 resource_tracker_(ResourceTracker::SINGLE_THREADED) { | |
81 DCHECK(!host_globals_); | 78 DCHECK(!host_globals_); |
82 host_globals_ = this; | 79 host_globals_ = this; |
83 } | 80 } |
84 | 81 |
85 HostGlobals::HostGlobals( | 82 HostGlobals::HostGlobals( |
86 ::ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test) | 83 ::ppapi::PpapiGlobals::PerThreadForTest per_thread_for_test) |
87 : ::ppapi::PpapiGlobals(per_thread_for_test), | 84 : ::ppapi::PpapiGlobals(per_thread_for_test) { |
88 resource_tracker_(ResourceTracker::SINGLE_THREADED) { | |
89 DCHECK(!host_globals_); | 85 DCHECK(!host_globals_); |
90 } | 86 } |
91 | 87 |
92 HostGlobals::~HostGlobals() { | 88 HostGlobals::~HostGlobals() { |
93 DCHECK(host_globals_ == this || !host_globals_); | 89 DCHECK(host_globals_ == this || !host_globals_); |
94 host_globals_ = NULL; | 90 host_globals_ = NULL; |
95 } | 91 } |
96 | 92 |
97 ::ppapi::ResourceTracker* HostGlobals::GetResourceTracker() { | 93 ::ppapi::ResourceTracker* HostGlobals::GetResourceTracker() { |
98 return &resource_tracker_; | 94 return &resource_tracker_; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return NULL; | 262 return NULL; |
267 return found->second; | 263 return found->second; |
268 } | 264 } |
269 | 265 |
270 bool HostGlobals::IsHostGlobals() const { | 266 bool HostGlobals::IsHostGlobals() const { |
271 return true; | 267 return true; |
272 } | 268 } |
273 | 269 |
274 } // namespace ppapi | 270 } // namespace ppapi |
275 } // namespace webkit | 271 } // namespace webkit |
OLD | NEW |