mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Apply clang-format to all C, C++ and ObjC files (issue #2171)
This commit is contained in:
@ -95,7 +95,8 @@ bool CefPostTask(CefThreadId threadId, const base::Closure& closure);
|
||||
///
|
||||
// Post a Closure for delayed execution on the specified thread.
|
||||
///
|
||||
bool CefPostDelayedTask(CefThreadId threadId, const base::Closure& closure,
|
||||
bool CefPostDelayedTask(CefThreadId threadId,
|
||||
const base::Closure& closure,
|
||||
int64 delay_ms);
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_CLOSURE_TASK_H_
|
||||
|
@ -46,12 +46,11 @@
|
||||
#include "include/base/cef_macros.h"
|
||||
#include "include/cef_task.h"
|
||||
|
||||
#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_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_RENDERER_THREAD() DCHECK(CefCurrentlyOn(TID_RENDERER));
|
||||
|
||||
|
||||
// Use this struct in conjuction with refcounted types to ensure that an
|
||||
// object is deleted on the specified thread. For example:
|
||||
//
|
||||
@ -72,9 +71,9 @@
|
||||
// foo->DoSomething();
|
||||
// foo = NULL; // Deletion of |foo| will occur on the UI thread.
|
||||
//
|
||||
template<CefThreadId thread>
|
||||
template <CefThreadId thread>
|
||||
struct CefDeleteOnThread {
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
static void Destruct(const T* x) {
|
||||
if (CefCurrentlyOn(thread)) {
|
||||
delete x;
|
||||
@ -85,11 +84,10 @@ struct CefDeleteOnThread {
|
||||
}
|
||||
};
|
||||
|
||||
struct CefDeleteOnUIThread : public CefDeleteOnThread<TID_UI> { };
|
||||
struct CefDeleteOnIOThread : public CefDeleteOnThread<TID_IO> { };
|
||||
struct CefDeleteOnFileThread : public CefDeleteOnThread<TID_FILE> { };
|
||||
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> { };
|
||||
|
||||
struct CefDeleteOnUIThread : public CefDeleteOnThread<TID_UI> {};
|
||||
struct CefDeleteOnIOThread : public CefDeleteOnThread<TID_IO> {};
|
||||
struct CefDeleteOnFileThread : public CefDeleteOnThread<TID_FILE> {};
|
||||
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
||||
|
||||
///
|
||||
// Helper class to manage a scoped copy of |argv|.
|
||||
@ -105,9 +103,7 @@ class CefScopedArgArray {
|
||||
}
|
||||
array_[argc] = NULL;
|
||||
}
|
||||
~CefScopedArgArray() {
|
||||
delete [] array_;
|
||||
}
|
||||
~CefScopedArgArray() { delete[] array_; }
|
||||
|
||||
char** array() const { return array_; }
|
||||
|
||||
@ -117,7 +113,7 @@ class CefScopedArgArray {
|
||||
// Keep values in a vector separate from |array_| because various users may
|
||||
// modify |array_| and we still want to clean up memory properly.
|
||||
std::vector<std::string> values_;
|
||||
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefScopedArgArray);
|
||||
};
|
||||
|
||||
|
@ -155,7 +155,8 @@
|
||||
// CefMessageRouterBrowserSide class documentation for the complete list of
|
||||
// methods.
|
||||
//
|
||||
// 5. Create an instance of CefMessageRouterRendererSide in the renderer process.
|
||||
// 5. Create an instance of CefMessageRouterRendererSide in the renderer
|
||||
// process.
|
||||
// You might choose to make it a member of your CefApp implementation, for
|
||||
// example.
|
||||
//
|
||||
@ -193,8 +194,8 @@
|
||||
|
||||
///
|
||||
// Used to configure the query router. The same values must be passed to both
|
||||
// CefMessageRouterBrowserSide and CefMessageRouterRendererSide. If using multiple
|
||||
// router pairs make sure to choose values that do not conflict.
|
||||
// CefMessageRouterBrowserSide and CefMessageRouterRendererSide. If using
|
||||
// multiple router pairs make sure to choose values that do not conflict.
|
||||
///
|
||||
struct CefMessageRouterConfig {
|
||||
CefMessageRouterConfig();
|
||||
@ -212,8 +213,8 @@ struct CefMessageRouterConfig {
|
||||
// Implements the browser side of query routing. The methods of this class may
|
||||
// be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
class CefMessageRouterBrowserSide :
|
||||
public base::RefCountedThreadSafe<CefMessageRouterBrowserSide> {
|
||||
class CefMessageRouterBrowserSide
|
||||
: public base::RefCountedThreadSafe<CefMessageRouterBrowserSide> {
|
||||
public:
|
||||
///
|
||||
// Callback associated with a single pending asynchronous query. Execute the
|
||||
@ -229,13 +230,13 @@ class CefMessageRouterBrowserSide :
|
||||
// Notify the associated JavaScript onSuccess callback that the query has
|
||||
// completed successfully with the specified |response|.
|
||||
///
|
||||
virtual void Success(const CefString& response) =0;
|
||||
virtual void Success(const CefString& response) = 0;
|
||||
|
||||
///
|
||||
// Notify the associated JavaScript onFailure callback that the query has
|
||||
// failed with the specified |error_code| and |error_message|.
|
||||
///
|
||||
virtual void Failure(int error_code, const CefString& error_message) =0;
|
||||
virtual void Failure(int error_code, const CefString& error_message) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
@ -294,7 +295,7 @@ class CefMessageRouterBrowserSide :
|
||||
// added. Must be called on the browser process UI thread. The Handler object
|
||||
// must either outlive the router or be removed before deletion.
|
||||
///
|
||||
virtual bool AddHandler(Handler* handler, bool first) =0;
|
||||
virtual bool AddHandler(Handler* handler, bool first) = 0;
|
||||
|
||||
///
|
||||
// Remove an existing query handler. Any pending queries associated with the
|
||||
@ -304,7 +305,7 @@ class CefMessageRouterBrowserSide :
|
||||
// if the handler is not found. Must be called on the browser process UI
|
||||
// thread.
|
||||
///
|
||||
virtual bool RemoveHandler(Handler* handler) =0;
|
||||
virtual bool RemoveHandler(Handler* handler) = 0;
|
||||
|
||||
///
|
||||
// Cancel all pending queries associated with either |browser| or |handler|.
|
||||
@ -314,7 +315,7 @@ class CefMessageRouterBrowserSide :
|
||||
// code of -1.
|
||||
///
|
||||
virtual void CancelPending(CefRefPtr<CefBrowser> browser,
|
||||
Handler* handler) =0;
|
||||
Handler* handler) = 0;
|
||||
|
||||
///
|
||||
// Returns the number of queries currently pending for the specified |browser|
|
||||
@ -322,19 +323,18 @@ class CefMessageRouterBrowserSide :
|
||||
// browser process UI thread.
|
||||
///
|
||||
virtual int GetPendingCount(CefRefPtr<CefBrowser> browser,
|
||||
Handler* handler) =0;
|
||||
|
||||
Handler* handler) = 0;
|
||||
|
||||
// The below methods should be called from other CEF handlers. They must be
|
||||
// called exactly as documented for the router to function correctly.
|
||||
|
||||
///
|
||||
// Call from CefLifeSpanHandler::OnBeforeClose. Any pending queries associated
|
||||
// with |browser| will be canceled and Handler::OnQueryCanceled will be called.
|
||||
// No JavaScript callbacks will be executed since this indicates destruction
|
||||
// of the browser.
|
||||
// with |browser| will be canceled and Handler::OnQueryCanceled will be
|
||||
// called. No JavaScript callbacks will be executed since this indicates
|
||||
// destruction of the browser.
|
||||
///
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) =0;
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) = 0;
|
||||
|
||||
///
|
||||
// Call from CefRequestHandler::OnRenderProcessTerminated. Any pending queries
|
||||
@ -342,7 +342,7 @@ class CefMessageRouterBrowserSide :
|
||||
// will be called. No JavaScript callbacks will be executed since this
|
||||
// indicates destruction of the context.
|
||||
///
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser) =0;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser) = 0;
|
||||
|
||||
///
|
||||
// Call from CefRequestHandler::OnBeforeBrowse only if the navigation is
|
||||
@ -352,7 +352,7 @@ class CefMessageRouterBrowserSide :
|
||||
// indicates destruction of the context.
|
||||
///
|
||||
virtual void OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) =0;
|
||||
CefRefPtr<CefFrame> frame) = 0;
|
||||
|
||||
///
|
||||
// Call from CefClient::OnProcessMessageReceived. Returns true if the message
|
||||
@ -361,7 +361,7 @@ class CefMessageRouterBrowserSide :
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) =0;
|
||||
CefRefPtr<CefProcessMessage> message) = 0;
|
||||
|
||||
protected:
|
||||
// Protect against accidental deletion of this object.
|
||||
@ -373,8 +373,8 @@ class CefMessageRouterBrowserSide :
|
||||
// Implements the renderer side of query routing. The methods of this class must
|
||||
// be called on the render process main thread.
|
||||
///
|
||||
class CefMessageRouterRendererSide :
|
||||
public base::RefCountedThreadSafe<CefMessageRouterRendererSide> {
|
||||
class CefMessageRouterRendererSide
|
||||
: public base::RefCountedThreadSafe<CefMessageRouterRendererSide> {
|
||||
public:
|
||||
///
|
||||
// Create a new router with the specified configuration.
|
||||
@ -387,8 +387,7 @@ class CefMessageRouterRendererSide :
|
||||
// and/or |context|. Either or both values may be empty.
|
||||
///
|
||||
virtual int GetPendingCount(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefV8Context> context) =0;
|
||||
|
||||
CefRefPtr<CefV8Context> context) = 0;
|
||||
|
||||
// The below methods should be called from other CEF handlers. They must be
|
||||
// called exactly as documented for the router to function correctly.
|
||||
@ -399,7 +398,7 @@ class CefMessageRouterRendererSide :
|
||||
///
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) =0;
|
||||
CefRefPtr<CefV8Context> context) = 0;
|
||||
|
||||
///
|
||||
// Call from CefRenderProcessHandler::OnContextReleased. Any pending queries
|
||||
@ -408,8 +407,8 @@ class CefMessageRouterRendererSide :
|
||||
///
|
||||
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) =0;
|
||||
|
||||
CefRefPtr<CefV8Context> context) = 0;
|
||||
|
||||
///
|
||||
// Call from CefRenderProcessHandler::OnProcessMessageReceived. Returns true
|
||||
// if the message is handled by this router or false otherwise.
|
||||
@ -417,7 +416,7 @@ class CefMessageRouterRendererSide :
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) =0;
|
||||
CefRefPtr<CefProcessMessage> message) = 0;
|
||||
|
||||
protected:
|
||||
// Protect against accidental deletion of this object.
|
||||
|
@ -55,8 +55,9 @@
|
||||
// Request object for additional usage information. The methods of this class
|
||||
// may be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
class CefResourceManager :
|
||||
public base::RefCountedThreadSafe<CefResourceManager, CefDeleteOnIOThread> {
|
||||
class CefResourceManager
|
||||
: public base::RefCountedThreadSafe<CefResourceManager,
|
||||
CefDeleteOnIOThread> {
|
||||
public:
|
||||
///
|
||||
// Provides an opportunity to modify |url| before it is passed to a provider.
|
||||
@ -64,15 +65,14 @@ class CefResourceManager :
|
||||
// file extension. |url| will be fully qualified and may contain query or
|
||||
// fragment components.
|
||||
///
|
||||
typedef base::Callback<std::string(
|
||||
const std::string& /*url*/)> UrlFilter;
|
||||
typedef base::Callback<std::string(const std::string& /*url*/)> UrlFilter;
|
||||
|
||||
///
|
||||
// Used to resolve mime types for URLs, usually based on the file extension.
|
||||
// |url| will be fully qualified and may contain query or fragment components.
|
||||
///
|
||||
typedef base::Callback<std::string(
|
||||
const std::string& /*url*/)> MimeTypeResolver;
|
||||
typedef base::Callback<std::string(const std::string& /*url*/)>
|
||||
MimeTypeResolver;
|
||||
|
||||
private:
|
||||
// Values that stay with a request as it moves between providers.
|
||||
@ -95,7 +95,7 @@ class CefResourceManager :
|
||||
// will no longer trigger) after Request::Continue or Request::Stop is called.
|
||||
// A request passed to Provider::OnRequestCanceled will already have been
|
||||
// detached. The methods of this class may be called on any browser process
|
||||
// thread.
|
||||
// thread.
|
||||
///
|
||||
class Request : public base::RefCountedThreadSafe<Request> {
|
||||
public:
|
||||
@ -110,7 +110,7 @@ class CefResourceManager :
|
||||
// Returns the CefBrowser associated with this request.
|
||||
///
|
||||
CefRefPtr<CefBrowser> browser() const { return params_.browser_; }
|
||||
|
||||
|
||||
///
|
||||
// Returns the CefFrame associated with this request.
|
||||
///
|
||||
@ -141,7 +141,7 @@ class CefResourceManager :
|
||||
// returned via CefResourceManager::GetResourceHandler. If |handler| is NULL
|
||||
// then the next provider in order, if any, will be called. If there are no
|
||||
// additional providers then NULL will be returned via CefResourceManager::
|
||||
// GetResourceHandler.
|
||||
// GetResourceHandler.
|
||||
///
|
||||
void Continue(CefRefPtr<CefResourceHandler> handler);
|
||||
|
||||
@ -151,7 +151,7 @@ class CefResourceManager :
|
||||
///
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
private:
|
||||
// Only allow deletion via scoped_refptr.
|
||||
friend class base::RefCountedThreadSafe<Request>;
|
||||
|
||||
@ -178,8 +178,7 @@ class CefResourceManager :
|
||||
DISALLOW_COPY_AND_ASSIGN(Request);
|
||||
};
|
||||
|
||||
typedef std::list<scoped_refptr<Request> > RequestList;
|
||||
|
||||
typedef std::list<scoped_refptr<Request>> RequestList;
|
||||
|
||||
///
|
||||
// Interface implemented by resource providers. A provider may be created on
|
||||
@ -195,7 +194,7 @@ class CefResourceManager :
|
||||
// asynchronously to indicate completion. See comments on Request for
|
||||
// additional usage information.
|
||||
///
|
||||
virtual bool OnRequest(scoped_refptr<Request> request) =0;
|
||||
virtual bool OnRequest(scoped_refptr<Request> request) = 0;
|
||||
|
||||
///
|
||||
// Called when a request has been canceled. It is still safe to dereference
|
||||
@ -232,7 +231,7 @@ class CefResourceManager :
|
||||
const std::string& directory_path,
|
||||
int order,
|
||||
const std::string& identifier);
|
||||
|
||||
|
||||
///
|
||||
// Add a provider that maps requests that start with |url_path| to files
|
||||
// stored in the archive file at |archive_path|. |url_path| should include an
|
||||
@ -284,7 +283,6 @@ class CefResourceManager :
|
||||
///
|
||||
void SetMimeTypeResolver(const MimeTypeResolver& resolver);
|
||||
|
||||
|
||||
// The below methods should be called from other CEF handlers. They must be
|
||||
// called exactly as documented for the manager to function correctly.
|
||||
|
||||
@ -314,7 +312,7 @@ class CefResourceManager :
|
||||
CefDeleteOnIOThread>;
|
||||
|
||||
~CefResourceManager();
|
||||
|
||||
|
||||
// Provider and associated information.
|
||||
struct ProviderEntry;
|
||||
typedef std::list<ProviderEntry*> ProviderEntryList;
|
||||
@ -358,14 +356,14 @@ class CefResourceManager :
|
||||
ProviderEntryList providers_;
|
||||
|
||||
// Map of response ID to pending CefResourceHandler object.
|
||||
typedef std::map<uint64, CefRefPtr<CefResourceHandler> > PendingHandlersMap;
|
||||
typedef std::map<uint64, CefRefPtr<CefResourceHandler>> PendingHandlersMap;
|
||||
PendingHandlersMap pending_handlers_;
|
||||
|
||||
UrlFilter url_filter_;
|
||||
MimeTypeResolver mime_type_resolver_;
|
||||
|
||||
// Must be the last member. Created and accessed on the IO thread.
|
||||
scoped_ptr<base::WeakPtrFactory<CefResourceManager> > weak_ptr_factory_;
|
||||
scoped_ptr<base::WeakPtrFactory<CefResourceManager>> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefResourceManager);
|
||||
};
|
||||
|
@ -80,8 +80,7 @@ class CefStreamResourceHandler : public CefResourceHandler {
|
||||
virtual void Cancel() OVERRIDE;
|
||||
|
||||
private:
|
||||
void ReadOnFileThread(int bytes_to_read,
|
||||
CefRefPtr<CefCallback> callback);
|
||||
void ReadOnFileThread(int bytes_to_read, CefRefPtr<CefCallback> callback);
|
||||
|
||||
const int status_code_;
|
||||
const CefString status_text_;
|
||||
|
@ -73,8 +73,8 @@ class CefStreamReader;
|
||||
///
|
||||
class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
|
||||
public:
|
||||
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
|
||||
typedef std::map<CefString, CefString > AttributeMap;
|
||||
typedef std::vector<CefRefPtr<CefXmlObject>> ObjectVector;
|
||||
typedef std::map<CefString, CefString> AttributeMap;
|
||||
|
||||
///
|
||||
// Create a new object with the specified name. An object name must always be
|
||||
@ -88,7 +88,8 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
|
||||
///
|
||||
bool Load(CefRefPtr<CefStreamReader> stream,
|
||||
CefXmlReader::EncodingType encodingType,
|
||||
const CefString& URI, CefString* loadError);
|
||||
const CefString& URI,
|
||||
CefString* loadError);
|
||||
|
||||
///
|
||||
// Set the name, children and attributes of this object to a duplicate of the
|
||||
|
@ -67,20 +67,20 @@ class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
|
||||
///
|
||||
// Returns the read-only data contained in the file.
|
||||
///
|
||||
virtual const unsigned char* GetData() const =0;
|
||||
virtual const unsigned char* GetData() const = 0;
|
||||
|
||||
///
|
||||
// Returns the size of the data in the file.
|
||||
///
|
||||
virtual size_t GetDataSize() const =0;
|
||||
virtual size_t GetDataSize() const = 0;
|
||||
|
||||
///
|
||||
// Returns a CefStreamReader object for streaming the contents of the file.
|
||||
///
|
||||
virtual CefRefPtr<CefStreamReader> GetStreamReader() const =0;
|
||||
virtual CefRefPtr<CefStreamReader> GetStreamReader() const = 0;
|
||||
};
|
||||
|
||||
typedef std::map<CefString, CefRefPtr<File> > FileMap;
|
||||
typedef std::map<CefString, CefRefPtr<File>> FileMap;
|
||||
|
||||
///
|
||||
// Create a new object.
|
||||
|
Reference in New Issue
Block a user