Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: webkit/support/webkit_support.cc

Issue 10664003: Add webkit_support::ReleaseMediaResources() on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/webkit_support.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/support/webkit_support.h" 5 #include "webkit/support/webkit_support.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "ui/gl/gl_surface.h" 50 #include "ui/gl/gl_surface.h"
51 #include "webkit/appcache/web_application_cache_host_impl.h" 51 #include "webkit/appcache/web_application_cache_host_impl.h"
52 #include "webkit/fileapi/isolated_context.h" 52 #include "webkit/fileapi/isolated_context.h"
53 #include "webkit/glue/user_agent.h" 53 #include "webkit/glue/user_agent.h"
54 #include "webkit/glue/webkit_constants.h" 54 #include "webkit/glue/webkit_constants.h"
55 #include "webkit/glue/webkit_glue.h" 55 #include "webkit/glue/webkit_glue.h"
56 #include "webkit/glue/webkitplatformsupport_impl.h" 56 #include "webkit/glue/webkitplatformsupport_impl.h"
57 #include "webkit/glue/weburlrequest_extradata_impl.h" 57 #include "webkit/glue/weburlrequest_extradata_impl.h"
58 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 58 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
59 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" 59 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
60 #if defined(OS_ANDROID)
61 #include "webkit/media/android/webmediaplayer_manager_android.h"
62 #endif
60 #include "webkit/media/webmediaplayer_impl.h" 63 #include "webkit/media/webmediaplayer_impl.h"
61 #include "webkit/plugins/npapi/plugin_list.h" 64 #include "webkit/plugins/npapi/plugin_list.h"
62 #include "webkit/plugins/npapi/webplugin_impl.h" 65 #include "webkit/plugins/npapi/webplugin_impl.h"
63 #include "webkit/plugins/npapi/webplugin_page_delegate.h" 66 #include "webkit/plugins/npapi/webplugin_page_delegate.h"
64 #include "webkit/plugins/webplugininfo.h" 67 #include "webkit/plugins/webplugininfo.h"
65 #include "webkit/support/platform_support.h" 68 #include "webkit/support/platform_support.h"
66 #include "webkit/support/simple_database_system.h" 69 #include "webkit/support/simple_database_system.h"
67 #include "webkit/support/test_webkit_platform_support.h" 70 #include "webkit/support/test_webkit_platform_support.h"
68 #include "webkit/support/test_webplugin_page_delegate.h" 71 #include "webkit/support/test_webplugin_page_delegate.h"
69 #include "webkit/tools/test_shell/simple_appcache_system.h" 72 #include "webkit/tools/test_shell/simple_appcache_system.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 logging::SetLogAssertHandler(UnitTestAssertHandler); 152 logging::SetLogAssertHandler(UnitTestAssertHandler);
150 } else { 153 } else {
151 // The existing_at_exit_manager must be not NULL. 154 // The existing_at_exit_manager must be not NULL.
152 at_exit_manager_.reset(existing_at_exit_manager); 155 at_exit_manager_.reset(existing_at_exit_manager);
153 InitLogging(); 156 InitLogging();
154 } 157 }
155 main_message_loop_.reset(new MessageLoopType); 158 main_message_loop_.reset(new MessageLoopType);
156 // TestWebKitPlatformSupport must be instantiated after MessageLoopType. 159 // TestWebKitPlatformSupport must be instantiated after MessageLoopType.
157 webkit_platform_support_.reset( 160 webkit_platform_support_.reset(
158 new TestWebKitPlatformSupport(unit_test_mode)); 161 new TestWebKitPlatformSupport(unit_test_mode));
162
163 #if defined(OS_ANDROID)
164 media_player_manager_.reset(
165 new webkit_media::WebMediaPlayerManagerAndroid());
166 #endif
159 } 167 }
160 168
161 ~TestEnvironment() { 169 ~TestEnvironment() {
162 SimpleResourceLoaderBridge::Shutdown(); 170 SimpleResourceLoaderBridge::Shutdown();
163 } 171 }
164 172
165 TestWebKitPlatformSupport* webkit_platform_support() const { 173 TestWebKitPlatformSupport* webkit_platform_support() const {
166 return webkit_platform_support_.get(); 174 return webkit_platform_support_.get();
167 } 175 }
168 176
(...skipping 13 matching lines...) Expand all
182 // in SetCurrentDirectoryForFileURL() and GetAbsoluteWebStringFromUTF8Path(), 190 // in SetCurrentDirectoryForFileURL() and GetAbsoluteWebStringFromUTF8Path(),
183 // as the directory might not exist on the device because we are using 191 // as the directory might not exist on the device because we are using
184 // file-over-http bridge. 192 // file-over-http bridge.
185 void set_mock_current_directory(const FilePath& directory) { 193 void set_mock_current_directory(const FilePath& directory) {
186 mock_current_directory_ = directory; 194 mock_current_directory_ = directory;
187 } 195 }
188 196
189 FilePath mock_current_directory() const { 197 FilePath mock_current_directory() const {
190 return mock_current_directory_; 198 return mock_current_directory_;
191 } 199 }
200
201 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() {
202 return media_player_manager_.get();
203 }
192 #endif 204 #endif
193 205
194 private: 206 private:
195 // Data member at_exit_manager_ will take the ownership of the input 207 // Data member at_exit_manager_ will take the ownership of the input
196 // AtExitManager and manage its lifecycle. 208 // AtExitManager and manage its lifecycle.
197 scoped_ptr<base::AtExitManager> at_exit_manager_; 209 scoped_ptr<base::AtExitManager> at_exit_manager_;
198 scoped_ptr<MessageLoopType> main_message_loop_; 210 scoped_ptr<MessageLoopType> main_message_loop_;
199 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; 211 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_;
200 212
201 #if defined(OS_ANDROID) 213 #if defined(OS_ANDROID)
202 FilePath mock_current_directory_; 214 FilePath mock_current_directory_;
215 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_;
203 #endif 216 #endif
204 }; 217 };
205 218
206 class WebPluginImplWithPageDelegate 219 class WebPluginImplWithPageDelegate
207 : public webkit_support::TestWebPluginPageDelegate, 220 : public webkit_support::TestWebPluginPageDelegate,
208 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, 221 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>,
209 public webkit::npapi::WebPluginImpl { 222 public webkit::npapi::WebPluginImpl {
210 public: 223 public:
211 WebPluginImplWithPageDelegate(WebFrame* frame, 224 WebPluginImplWithPageDelegate(WebFrame* frame,
212 const WebPluginParams& params, 225 const WebPluginParams& params,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 new media::MediaLog()); 390 new media::MediaLog());
378 #endif 391 #endif
379 } 392 }
380 393
381 WebKit::WebMediaPlayer* CreateMediaPlayer( 394 WebKit::WebMediaPlayer* CreateMediaPlayer(
382 WebFrame* frame, 395 WebFrame* frame,
383 WebMediaPlayerClient* client) { 396 WebMediaPlayerClient* client) {
384 return CreateMediaPlayer(frame, client, NULL); 397 return CreateMediaPlayer(frame, client, NULL);
385 } 398 }
386 399
400 #if defined(OS_ANDROID)
401 void ReleaseMediaResources() {
402 test_environment->media_player_manager()->ReleaseMediaResources();
403 }
404 #endif
405
387 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost( 406 WebKit::WebApplicationCacheHost* CreateApplicationCacheHost(
388 WebFrame*, WebKit::WebApplicationCacheHostClient* client) { 407 WebFrame*, WebKit::WebApplicationCacheHostClient* client) {
389 return SimpleAppCacheSystem::CreateApplicationCacheHost(client); 408 return SimpleAppCacheSystem::CreateApplicationCacheHost(client);
390 } 409 }
391 410
392 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) { 411 WebKit::WebStorageNamespace* CreateSessionStorageNamespace(unsigned quota) {
393 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace(); 412 return SimpleDomStorageSystem::instance().CreateSessionStorageNamespace();
394 } 413 }
395 414
396 WebKit::WebString GetWebKitRootDir() { 415 WebKit::WebString GetWebKitRootDir() {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 // Logging 807 // Logging
789 void EnableWebCoreLogChannels(const std::string& channels) { 808 void EnableWebCoreLogChannels(const std::string& channels) {
790 webkit_glue::EnableWebCoreLogChannels(channels); 809 webkit_glue::EnableWebCoreLogChannels(channels);
791 } 810 }
792 811
793 void SetGamepadData(const WebKit::WebGamepads& pads) { 812 void SetGamepadData(const WebKit::WebGamepads& pads) {
794 test_environment->webkit_platform_support()->setGamepadData(pads); 813 test_environment->webkit_platform_support()->setGamepadData(pads);
795 } 814 }
796 815
797 } // namespace webkit_support 816 } // namespace webkit_support
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698