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

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

Issue 15993018: Reland: Use a shared thread for media operations (round 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix stop race Created 7 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
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // file-over-http bridge. 203 // file-over-http bridge.
204 void set_mock_current_directory(const base::FilePath& directory) { 204 void set_mock_current_directory(const base::FilePath& directory) {
205 mock_current_directory_ = directory; 205 mock_current_directory_ = directory;
206 } 206 }
207 207
208 base::FilePath mock_current_directory() const { 208 base::FilePath mock_current_directory() const {
209 return mock_current_directory_; 209 return mock_current_directory_;
210 } 210 }
211 #endif 211 #endif
212 212
213 scoped_refptr<base::MessageLoopProxy> GetMediaThreadMessageLoopProxy() {
214 if (!media_thread_) {
215 media_thread_.reset(new base::Thread("Media"));
216 CHECK(media_thread_->Start());
217 }
218 return media_thread_->message_loop_proxy();
219 }
220
213 private: 221 private:
214 // Data member at_exit_manager_ will take the ownership of the input 222 // Data member at_exit_manager_ will take the ownership of the input
215 // AtExitManager and manage its lifecycle. 223 // AtExitManager and manage its lifecycle.
216 scoped_ptr<base::AtExitManager> at_exit_manager_; 224 scoped_ptr<base::AtExitManager> at_exit_manager_;
217 scoped_ptr<MessageLoopType> main_message_loop_; 225 scoped_ptr<MessageLoopType> main_message_loop_;
218 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_; 226 scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_;
219 scoped_ptr<TestWebIDBFactory> idb_factory_; 227 scoped_ptr<TestWebIDBFactory> idb_factory_;
220 228
229 scoped_ptr<base::Thread> media_thread_;
230
221 #if defined(OS_ANDROID) 231 #if defined(OS_ANDROID)
222 base::FilePath mock_current_directory_; 232 base::FilePath mock_current_directory_;
223 #endif 233 #endif
224 }; 234 };
225 235
226 class WebPluginImplWithPageDelegate 236 class WebPluginImplWithPageDelegate
227 : public webkit_support::TestWebPluginPageDelegate, 237 : public webkit_support::TestWebPluginPageDelegate,
228 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>, 238 public base::SupportsWeakPtr<WebPluginImplWithPageDelegate>,
229 public webkit::npapi::WebPluginImpl { 239 public webkit::npapi::WebPluginImpl {
230 public: 240 public:
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 client, 412 client,
403 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), 413 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
404 media_stream_client, 414 media_stream_client,
405 new media::MediaLog()); 415 new media::MediaLog());
406 } 416 }
407 417
408 #if defined(OS_ANDROID) 418 #if defined(OS_ANDROID)
409 return NULL; 419 return NULL;
410 #else 420 #else
411 webkit_media::WebMediaPlayerParams params( 421 webkit_media::WebMediaPlayerParams params(
422 test_environment->GetMediaThreadMessageLoopProxy(),
412 NULL, NULL, new media::MediaLog()); 423 NULL, NULL, new media::MediaLog());
413 return new webkit_media::WebMediaPlayerImpl( 424 return new webkit_media::WebMediaPlayerImpl(
414 frame, 425 frame,
415 client, 426 client,
416 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), 427 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
417 params); 428 params);
418 #endif 429 #endif
419 } 430 }
420 431
421 WebKit::WebMediaPlayer* CreateMediaPlayer( 432 WebKit::WebMediaPlayer* CreateMediaPlayer(
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 // Logging 857 // Logging
847 void EnableWebCoreLogChannels(const std::string& channels) { 858 void EnableWebCoreLogChannels(const std::string& channels) {
848 webkit_glue::EnableWebCoreLogChannels(channels); 859 webkit_glue::EnableWebCoreLogChannels(channels);
849 } 860 }
850 861
851 void SetGamepadData(const WebKit::WebGamepads& pads) { 862 void SetGamepadData(const WebKit::WebGamepads& pads) {
852 test_environment->webkit_platform_support()->setGamepadData(pads); 863 test_environment->webkit_platform_support()->setGamepadData(pads);
853 } 864 }
854 865
855 } // namespace webkit_support 866 } // namespace webkit_support
OLDNEW
« media/base/pipeline_unittest.cc ('K') | « webkit/renderer/media/webmediaplayer_params.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698