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

Side by Side Diff: chrome/browser/media_gallery/scoped_mtp_device_map_entry.cc

Issue 11442047: Media Galleries: Add more tests for media gallery names. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years 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 | « chrome/browser/media_gallery/media_file_system_registry_unittest.cc ('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 "chrome/browser/media_gallery/scoped_mtp_device_map_entry.h" 5 #include "chrome/browser/media_gallery/scoped_mtp_device_map_entry.h"
6 6
7 #include "webkit/fileapi/media/mtp_device_file_system_config.h" 7 #include "webkit/fileapi/media/mtp_device_file_system_config.h"
8 8
9 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 9 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/browser/media_gallery/mtp_device_delegate_impl.h" 11 #include "chrome/browser/media_gallery/mtp_device_delegate_impl.h"
12 #include "webkit/fileapi/file_system_task_runners.h" 12 #include "webkit/fileapi/file_system_task_runners.h"
13 #include "webkit/fileapi/media/mtp_device_map_service.h" 13 #include "webkit/fileapi/media/mtp_device_map_service.h"
14 #endif 14 #endif
15 15
16 namespace chrome { 16 namespace chrome {
17 17
18 namespace { 18 namespace {
19 19
20 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 20 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
21 bool IsMediaTaskRunnerThread() { 21 bool IsMediaTaskRunnerThread() {
22 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 22 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
23 base::SequencedWorkerPool::SequenceToken media_sequence_token = 23 base::SequencedWorkerPool::SequenceToken media_sequence_token =
24 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName); 24 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName);
25 return pool->IsRunningSequenceOnCurrentThread(media_sequence_token); 25 return pool->IsRunningSequenceOnCurrentThread(media_sequence_token);
26 } 26 }
27 27
28 base::SequencedTaskRunner* GetSequencedTaskRunner() { 28 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() {
Lei Zhang 2012/12/20 01:33:55 If I don't do this, I get a crash in debug mode:
29 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 29 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
30 base::SequencedWorkerPool::SequenceToken media_sequence_token = 30 base::SequencedWorkerPool::SequenceToken media_sequence_token =
31 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName); 31 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName);
32 return pool->GetSequencedTaskRunner(media_sequence_token); 32 return pool->GetSequencedTaskRunner(media_sequence_token);
33 } 33 }
34 #endif 34 #endif
35 35
36 } // namespace 36 } // namespace
37 37
38 ScopedMTPDeviceMapEntry::ScopedMTPDeviceMapEntry( 38 ScopedMTPDeviceMapEntry::ScopedMTPDeviceMapEntry(
(...skipping 24 matching lines...) Expand all
63 void ScopedMTPDeviceMapEntry::OnMTPDeviceDelegateCreated( 63 void ScopedMTPDeviceMapEntry::OnMTPDeviceDelegateCreated(
64 fileapi::MTPDeviceDelegate* delegate) { 64 fileapi::MTPDeviceDelegate* delegate) {
65 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 65 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
66 DCHECK(IsMediaTaskRunnerThread()); 66 DCHECK(IsMediaTaskRunnerThread());
67 fileapi::MTPDeviceMapService::GetInstance()->AddDelegate(device_location_, 67 fileapi::MTPDeviceMapService::GetInstance()->AddDelegate(device_location_,
68 delegate); 68 delegate);
69 #endif 69 #endif
70 } 70 }
71 71
72 } // namespace chrome 72 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/media_gallery/media_file_system_registry_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698