Update wrapper implementations to use base types (issue #1336).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1775 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-07-15 17:19:43 +00:00
parent f9bf8dfa10
commit 646ae3310f
7 changed files with 105 additions and 90 deletions

View File

@@ -37,6 +37,7 @@
#define CEF_INCLUDE_WRAPPER_CEF_MESSAGE_ROUTER_H_
#pragma once
#include "include/base/cef_ref_counted.h"
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_process_message.h"
@@ -211,7 +212,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 CefBase {
class CefMessageRouterBrowserSide :
public base::RefCountedThreadSafe<CefMessageRouterBrowserSide> {
public:
///
// Callback associated with a single pending asynchronous query. Execute the
@@ -360,16 +362,20 @@ class CefMessageRouterBrowserSide : public CefBase {
CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) =0;
protected:
// Protect against accidental deletion of this object.
friend class base::RefCountedThreadSafe<CefMessageRouterBrowserSide>;
virtual ~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 CefBase {
class CefMessageRouterRendererSide :
public base::RefCountedThreadSafe<CefMessageRouterRendererSide> {
public:
virtual ~CefMessageRouterRendererSide() {}
///
// Create a new router with the specified configuration.
///
@@ -412,6 +418,11 @@ class CefMessageRouterRendererSide : public CefBase {
CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) =0;
protected:
// Protect against accidental deletion of this object.
friend class base::RefCountedThreadSafe<CefMessageRouterRendererSide>;
virtual ~CefMessageRouterRendererSide() {}
};
#endif // CEF_INCLUDE_WRAPPER_CEF_MESSAGE_ROUTER_H_

View File

@@ -38,6 +38,7 @@
#pragma once
#include "include/base/cef_macros.h"
#include "include/base/cef_scoped_ptr.h"
#include "include/cef_base.h"
#include "include/cef_resource_handler.h"
#include "include/cef_response.h"
@@ -89,7 +90,7 @@ class CefStreamResourceHandler : public CefResourceHandler {
bool read_on_file_thread_;
class Buffer;
Buffer* buffer_;
scoped_ptr<Buffer> buffer_;
#ifndef NDEBUG
// Used in debug builds to verify that |buffer_| isn't being accessed on
// multiple threads at the same time.

View File

@@ -37,13 +37,15 @@
#define CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_
#pragma once
#include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h"
#include "include/cef_xml_reader.h"
#include <map>
#include <vector>
#include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h"
#include "include/cef_base.h"
#include "include/cef_xml_reader.h"
class CefStreamReader;
///
@@ -69,7 +71,7 @@ class CefStreamReader;
// (c) Element nodes are represented by their outer XML string.
// </pre>
///
class CefXmlObject : public CefBase {
class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
public:
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
typedef std::map<CefString, CefString > AttributeMap;
@@ -79,7 +81,6 @@ class CefXmlObject : public CefBase {
// at least one character long.
///
explicit CefXmlObject(const CefString& name);
virtual ~CefXmlObject();
///
// Load the contents of the specified XML stream into this object. The
@@ -175,6 +176,10 @@ class CefXmlObject : public CefBase {
size_t FindChildren(const CefString& name, ObjectVector& children);
private:
// Protect against accidental deletion of this object.
friend class base::RefCountedThreadSafe<CefXmlObject>;
~CefXmlObject();
void SetParent(CefXmlObject* parent);
CefString name_;
@@ -185,7 +190,6 @@ class CefXmlObject : public CefBase {
base::Lock lock_;
IMPLEMENT_REFCOUNTING(CefXmlObject);
DISALLOW_COPY_AND_ASSIGN(CefXmlObject);
};

View File

@@ -37,10 +37,12 @@
#define CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_
#pragma once
#include <map>
#include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h"
#include "include/cef_base.h"
#include <map>
class CefStreamReader;
@@ -49,13 +51,12 @@ class CefStreamReader;
// not be used with large archive files because all data will be resident in
// memory at the same time. This implementation supports a restricted set of zip
// archive features:
// (1) Password-protected files are not supported.
// (2) All file names are stored and compared in lower case.
// (3) File ordering from the original zip archive is not maintained. This
// (1) All file names are stored and compared in lower case.
// (2) File ordering from the original zip archive is not maintained. This
// means that files from the same folder may not be located together in the
// file content map.
///
class CefZipArchive : public CefBase {
class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
public:
///
// Class representing a file in the archive. Accessing the file data from
@@ -66,25 +67,25 @@ class CefZipArchive : public CefBase {
///
// Returns the read-only data contained in the file.
///
virtual const unsigned char* GetData() =0;
virtual const unsigned char* GetData() const =0;
///
// Returns the size of the data in the file.
///
virtual size_t GetDataSize() =0;
virtual size_t GetDataSize() const =0;
///
// Returns a CefStreamReader object for streaming the contents of the file.
///
virtual CefRefPtr<CefStreamReader> GetStreamReader() =0;
virtual CefRefPtr<CefStreamReader> GetStreamReader() const =0;
};
typedef std::map<CefString, CefRefPtr<File> > FileMap;
///
// Create a new object.
///
CefZipArchive();
virtual ~CefZipArchive();
///
// Load the contents of the specified zip archive stream into this object.
@@ -105,17 +106,17 @@ class CefZipArchive : public CefBase {
///
// Returns the number of files in the archive.
///
size_t GetFileCount();
size_t GetFileCount() const;
///
// Returns true if the specified file exists and has contents.
///
bool HasFile(const CefString& fileName);
bool HasFile(const CefString& fileName) const;
///
// Returns the specified file.
///
CefRefPtr<File> GetFile(const CefString& fileName);
CefRefPtr<File> GetFile(const CefString& fileName) const;
///
// Removes the specified file.
@@ -125,14 +126,17 @@ class CefZipArchive : public CefBase {
///
// Returns the map of all files.
///
size_t GetFiles(FileMap& map);
size_t GetFiles(FileMap& map) const;
private:
// Protect against accidental deletion of this object.
friend class base::RefCountedThreadSafe<CefZipArchive>;
~CefZipArchive();
FileMap contents_;
base::Lock lock_;
mutable base::Lock lock_;
IMPLEMENT_REFCOUNTING(CefZipArchive);
DISALLOW_COPY_AND_ASSIGN(CefZipArchive);
};