Remove the TID_FILE default value
Clients should instead make an informed decision about which blocking thread to use. See cef_thread_id_t documentation for guidance.
This commit is contained in:
parent
d9efaee9b9
commit
ff8f4a7217
|
@ -42,13 +42,13 @@
|
|||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "d026196d35d8894a836ab3a3d033b84195cdb835"
|
||||
#define CEF_API_HASH_UNIVERSAL "b2f96ef79b0a316e88dae7c885675ab4e012a1fd"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "4150bd26e7bf639a9b1f3e5860af8c76eeae8570"
|
||||
#define CEF_API_HASH_PLATFORM "a6f28bd2c6d7248655ede7f2ad0eb01c3b53bbb5"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "5cc32f88bd134410eff86b21095138b339d572f2"
|
||||
#define CEF_API_HASH_PLATFORM "3398ee95844446efa42cc366fb08c37f739b7fbd"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "b227b3fdd6142a9d8ff0f2252a71425f15960800"
|
||||
#define CEF_API_HASH_PLATFORM "00a4ab72830b926411b311f5985e31e8146cedba"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1458,7 +1458,6 @@ typedef enum {
|
|||
// CefShutdown() are guaranteed to run.
|
||||
///
|
||||
TID_FILE_BACKGROUND,
|
||||
TID_FILE = TID_FILE_BACKGROUND,
|
||||
|
||||
///
|
||||
// Used for blocking tasks (e.g. file system access) that affect UI or
|
||||
|
|
|
@ -48,7 +48,12 @@
|
|||
|
||||
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
|
||||
#define CEF_REQUIRE_IO_THREAD() DCHECK(CefCurrentlyOn(TID_IO));
|
||||
#define CEF_REQUIRE_FILE_THREAD() DCHECK(CefCurrentlyOn(TID_FILE));
|
||||
#define CEF_REQUIRE_FILE_BACKGROUND_THREAD() \
|
||||
DCHECK(CefCurrentlyOn(TID_FILE_BACKGROUND));
|
||||
#define CEF_REQUIRE_FILE_USER_VISIBLE_THREAD() \
|
||||
DCHECK(CefCurrentlyOn(TID_FILE_USER_VISIBLE));
|
||||
#define CEF_REQUIRE_FILE_USER_BLOCKING_THREAD() \
|
||||
DCHECK(CefCurrentlyOn(TID_FILE_USER_BLOCKING));
|
||||
#define CEF_REQUIRE_RENDERER_THREAD() DCHECK(CefCurrentlyOn(TID_RENDERER));
|
||||
|
||||
// Use this struct in conjuction with refcounted types to ensure that an
|
||||
|
@ -86,7 +91,12 @@ struct CefDeleteOnThread {
|
|||
|
||||
struct CefDeleteOnUIThread : public CefDeleteOnThread<TID_UI> {};
|
||||
struct CefDeleteOnIOThread : public CefDeleteOnThread<TID_IO> {};
|
||||
struct CefDeleteOnFileThread : public CefDeleteOnThread<TID_FILE> {};
|
||||
struct CefDeleteOnFileBackgroundThread
|
||||
: public CefDeleteOnThread<TID_FILE_BACKGROUND> {};
|
||||
struct CefDeleteOnFileUserVisibleThread
|
||||
: public CefDeleteOnThread<TID_FILE_USER_VISIBLE> {};
|
||||
struct CefDeleteOnFileUserBlockingThread
|
||||
: public CefDeleteOnThread<TID_FILE_USER_BLOCKING> {};
|
||||
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
||||
|
||||
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
|
||||
|
@ -114,7 +124,6 @@ struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
|||
#define IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(ClassName) \
|
||||
IMPLEMENT_REFCOUNTING_EX(ClassName, CefDeleteOnIOThread)
|
||||
|
||||
|
||||
///
|
||||
// Helper class to manage a scoped copy of |argv|.
|
||||
///
|
||||
|
|
|
@ -116,8 +116,9 @@ class DirectoryProvider : public CefResourceManager::Provider {
|
|||
const std::string& file_path = GetFilePath(url);
|
||||
|
||||
// Open |file_path| on the FILE thread.
|
||||
CefPostTask(TID_FILE, base::Bind(&DirectoryProvider::OpenOnFileThread,
|
||||
file_path, request));
|
||||
CefPostTask(
|
||||
TID_FILE_USER_BLOCKING,
|
||||
base::Bind(&DirectoryProvider::OpenOnFileThread, file_path, request));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ class DirectoryProvider : public CefResourceManager::Provider {
|
|||
static void OpenOnFileThread(
|
||||
const std::string& file_path,
|
||||
scoped_refptr<CefResourceManager::Request> request) {
|
||||
CEF_REQUIRE_FILE_THREAD();
|
||||
CEF_REQUIRE_FILE_USER_BLOCKING_THREAD();
|
||||
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
CefStreamReader::CreateForFile(file_path);
|
||||
|
@ -198,9 +199,10 @@ class ArchiveProvider : public CefResourceManager::Provider {
|
|||
pending_requests_.push_back(request);
|
||||
|
||||
// Load the archive file on the FILE thread.
|
||||
CefPostTask(TID_FILE, base::Bind(&ArchiveProvider::LoadOnFileThread,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
archive_path_, password_));
|
||||
CefPostTask(
|
||||
TID_FILE_USER_BLOCKING,
|
||||
base::Bind(&ArchiveProvider::LoadOnFileThread,
|
||||
weak_ptr_factory_.GetWeakPtr(), archive_path_, password_));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -218,7 +220,7 @@ class ArchiveProvider : public CefResourceManager::Provider {
|
|||
static void LoadOnFileThread(base::WeakPtr<ArchiveProvider> ptr,
|
||||
const std::string& archive_path,
|
||||
const std::string& password) {
|
||||
CEF_REQUIRE_FILE_THREAD();
|
||||
CEF_REQUIRE_FILE_USER_BLOCKING_THREAD();
|
||||
|
||||
CefRefPtr<CefZipArchive> archive;
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ ImageCache::ImageType ImageCache::GetImageType(const std::string& path) {
|
|||
void ImageCache::LoadMissing(const ImageInfoSet& image_info,
|
||||
const ImageSet& images,
|
||||
const LoadImagesCallback& callback) {
|
||||
DCHECK(!CefCurrentlyOn(TID_UI) && !CefCurrentlyOn(TID_IO));
|
||||
CEF_REQUIRE_FILE_USER_BLOCKING_THREAD();
|
||||
|
||||
DCHECK_EQ(image_info.size(), images.size());
|
||||
|
||||
|
@ -195,7 +195,7 @@ void ImageCache::LoadMissing(const ImageInfoSet& image_info,
|
|||
// static
|
||||
bool ImageCache::LoadImageContents(const ImageInfo& info,
|
||||
ImageContent* content) {
|
||||
DCHECK(!CefCurrentlyOn(TID_UI) && !CefCurrentlyOn(TID_IO));
|
||||
CEF_REQUIRE_FILE_USER_BLOCKING_THREAD();
|
||||
|
||||
ImageRepSet::const_iterator it = info.reps_.begin();
|
||||
for (; it != info.reps_.end(); ++it) {
|
||||
|
@ -220,7 +220,7 @@ bool ImageCache::LoadImageContents(const std::string& path,
|
|||
bool internal,
|
||||
ImageType* type,
|
||||
std::string* contents) {
|
||||
DCHECK(!CefCurrentlyOn(TID_UI) && !CefCurrentlyOn(TID_IO));
|
||||
CEF_REQUIRE_FILE_USER_BLOCKING_THREAD();
|
||||
|
||||
*type = GetImageType(path);
|
||||
if (*type == TYPE_NONE)
|
||||
|
|
|
@ -70,9 +70,9 @@ void RunManifestCallback(const ManifestCallback& callback,
|
|||
// Asynchronously reads the manifest and executes |callback| on the UI thread.
|
||||
void GetInternalManifest(const std::string& extension_path,
|
||||
const ManifestCallback& callback) {
|
||||
if (!CefCurrentlyOn(TID_FILE)) {
|
||||
if (!CefCurrentlyOn(TID_FILE_USER_BLOCKING)) {
|
||||
// Execute on the browser FILE thread.
|
||||
CefPostTask(TID_FILE,
|
||||
CefPostTask(TID_FILE_USER_BLOCKING,
|
||||
base::Bind(GetInternalManifest, extension_path, callback));
|
||||
return;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ std::string GetExtensionResourcePath(const std::string& extension_path,
|
|||
|
||||
bool GetExtensionResourceContents(const std::string& extension_path,
|
||||
std::string& contents) {
|
||||
CEF_REQUIRE_FILE_THREAD();
|
||||
CEF_REQUIRE_FILE_USER_BLOCKING_THREAD();
|
||||
|
||||
if (IsInternalExtension(extension_path)) {
|
||||
const std::string& contents_path =
|
||||
|
|
Loading…
Reference in New Issue