#include <stddef.h>
#include <stdint.h>
-
+#include "base/logging.h"
#include "base/values.h"
#include "content/common/font_list.h"
#include "content/public/browser/browser_ppapi_host.h"
PpapiHostMsg_BrowserFontSingleton_GetFontFamilies,
OnHostMsgGetFontFamilies)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/logging.h"
#include "base/task/task_runner_util.h"
#include "base/task/thread_pool.h"
#include "content/browser/child_process_security_policy_impl.h"
int32_t PepperExternalFileRefBackend::MakeDirectory(
ppapi::host::ReplyMessageContext reply_context,
int32_t make_directory_flags) {
+ LOG(ERROR) << "Operation not supported for external filesystems";
// This operation isn't supported for external filesystems.
return PP_ERROR_NOACCESS;
}
int32_t PepperExternalFileRefBackend::Delete(
ppapi::host::ReplyMessageContext reply_context) {
+ LOG(ERROR) << "Operation not supported for external filesystems";
// This operation isn't supported for external filesystems.
return PP_ERROR_NOACCESS;
}
int32_t PepperExternalFileRefBackend::Rename(
ppapi::host::ReplyMessageContext reply_context,
PepperFileRefHost* new_file_ref) {
+ LOG(ERROR) << "Operation not supported for external filesystems";
// This operation isn't supported for external filesystems.
return PP_ERROR_NOACCESS;
}
int32_t PepperExternalFileRefBackend::ReadDirectoryEntries(
ppapi::host::ReplyMessageContext context) {
+ LOG(ERROR) << "Operation not supported for external filesystems";
// This operation isn't supported for external filesystems.
return PP_ERROR_NOACCESS;
}
int32_t PepperExternalFileRefBackend::CanRead() const {
if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
render_process_id_, path_)) {
+ LOG(ERROR) << "Insufficient permissions - cannot read the file";
return PP_ERROR_NOACCESS;
}
return PP_OK;
int32_t PepperExternalFileRefBackend::CanReadWrite() const {
if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanCreateReadWriteFile(
render_process_id_, path_)) {
+ LOG(ERROR) << "Insufficient permissions - cannot read or write to the file";
return PP_ERROR_NOACCESS;
}
return PP_OK;
#include "base/bind.h"
#include "base/callback.h"
+#include "base/logging.h"
#include "base/callback_forward.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN})),
file_(task_runner_.get()),
+ resolved_render_process_id_(base::kNullProcessId),
open_flags_(0),
file_system_type_(PP_FILESYSTEMTYPE_INVALID),
max_written_offset_(0),
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_RequestOSFileHandle,
OnHostMsgRequestOSFileHandle)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Message not resolved";
return PP_ERROR_FAILED;
}
uint32_t platform_file_flags = 0;
if (!ppapi::PepperFileOpenFlagsToPlatformFileFlags(open_flags,
- &platform_file_flags))
+ &platform_file_flags)) {
+ LOG(ERROR);
return PP_ERROR_BADARGUMENT;
+ }
ppapi::host::ResourceHost* resource_host =
host()->GetResourceHost(file_ref_resource);
- if (!resource_host || !resource_host->IsFileRefHost())
+ if (!resource_host || !resource_host->IsFileRefHost()) {
+ LOG(ERROR) << "Invalid Resource";
return PP_ERROR_BADRESOURCE;
+ }
PepperFileRefHost* file_ref_host =
static_cast<PepperFileRefHost*>(resource_host);
- if (file_ref_host->GetFileSystemType() == PP_FILESYSTEMTYPE_INVALID)
+ if (file_ref_host->GetFileSystemType() == PP_FILESYSTEMTYPE_INVALID) {
+ LOG(ERROR) << "Invalid FileSystem type";
return PP_ERROR_FAILED;
+ }
file_system_host_ = file_ref_host->GetFileSystemHost();
file_system_url_.is_valid();
if (is_internal_type) {
- if (!file_system_url_.is_valid())
+ if (!file_system_url_.is_valid()) {
+ LOG(ERROR) << "Invalid URL";
return PP_ERROR_BADARGUMENT;
+ }
// Not all external file systems are fully supported yet.
// Whitelist the supported ones.
case storage::kFileSystemTypeDeviceMedia:
break;
default:
+ LOG(ERROR) << "External file system of type "
+ << file_system_url_.type() << " not supported";
return PP_ERROR_NOACCESS;
}
}
- if (!CanOpenFileSystemURLWithPepperFlags(
- open_flags, render_process_id_, file_system_url_))
+ if (!CanOpenFileSystemURLWithPepperFlags(open_flags, render_process_id_,
+ file_system_url_)) {
+ LOG(ERROR) << "Cannot open file system URL with pepper flags";
return PP_ERROR_NOACCESS;
+ }
GotUIThreadStuffForInternalFileSystems(
context->MakeReplyMessageContext(), platform_file_flags,
GetUIThreadStuffForInternalFileSystems(render_process_id_));
} else {
base::FilePath path = file_ref_host->GetExternalFilePath();
- if (!CanOpenWithPepperFlags(open_flags, render_process_id_, path))
+ if (!CanOpenWithPepperFlags(open_flags, render_process_id_, path)) {
+ LOG(ERROR) << "Cannot open with pepper flags";
return PP_ERROR_NOACCESS;
+ }
GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&GetResolvedRenderProcessId, render_process_id_),
PPTimeToTime(last_access_time), PPTimeToTime(last_modified_time),
base::BindOnce(&PepperFileIOHost::ExecutePlatformGeneralCallback,
AsWeakPtr(), context->MakeReplyMessageContext()))) {
+ LOG(ERROR) << "Could not modify file access and modification times";
return PP_ERROR_FAILED;
}
FileIOStateManager::OPERATION_EXCLUSIVE, true);
if (rv != PP_OK)
return rv;
- if (length < 0)
+ if (length < 0) {
+ LOG(ERROR) << "New length cannot be less than 0, length=" << length;
return PP_ERROR_BADARGUMENT;
+ }
// Quota checks are performed on the plugin side, in order to use the same
// quota reservation and request system as Write.
length,
base::BindOnce(&PepperFileIOHost::ExecutePlatformGeneralCallback,
AsWeakPtr(), context->MakeReplyMessageContext()))) {
+ LOG(ERROR) << "SetLength failed";
return PP_ERROR_FAILED;
}
if (!file_.Flush(
base::BindOnce(&PepperFileIOHost::ExecutePlatformGeneralCallback,
AsWeakPtr(), context->MakeReplyMessageContext()))) {
+ LOG(ERROR) << "Flush failed";
return PP_ERROR_FAILED;
}
int32_t PepperFileIOHost::OnHostMsgRequestOSFileHandle(
ppapi::host::HostMessageContext* context) {
- if (open_flags_ != PP_FILEOPENFLAG_READ && file_system_host_->ChecksQuota())
+ if (open_flags_ != PP_FILEOPENFLAG_READ && file_system_host_->ChecksQuota()) {
+ LOG(ERROR);
return PP_ERROR_FAILED;
+ }
GURL document_url =
browser_ppapi_host_->GetDocumentURLForInstance(pp_instance());
#include <memory>
#include <string>
+#include "base/logging.h"
#include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend.h"
#include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h"
#include "content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h"
int32_t PepperFileRefHost::CanRead() const {
if (backend_)
return backend_->CanRead();
+ LOG(ERROR) << "Invalid PepperFileRefBackend";
return PP_ERROR_FAILED;
}
int32_t PepperFileRefHost::CanWrite() const {
if (backend_)
return backend_->CanWrite();
+ LOG(ERROR) << "Invalid PepperFileRefBackend";
return PP_ERROR_FAILED;
}
int32_t PepperFileRefHost::CanCreate() const {
if (backend_)
return backend_->CanCreate();
+ LOG(ERROR) << "Invalid PepperFileRefBackend";
return PP_ERROR_FAILED;
}
int32_t PepperFileRefHost::CanReadWrite() const {
if (backend_)
return backend_->CanReadWrite();
+ LOG(ERROR) << "Invalid PepperFileRefBackend";
return PP_ERROR_FAILED;
}
int32_t PepperFileRefHost::OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) {
- if (!backend_)
+ if (!backend_) {
+ LOG(ERROR) << "Invalid PepperFileRefBackend";
return PP_ERROR_FAILED;
+ }
PPAPI_BEGIN_MESSAGE_MAP(PepperFileRefHost, msg)
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileRef_MakeDirectory,
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileRef_GetAbsolutePath,
OnGetAbsolutePath)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
ResourceHost* resource_host =
host_->GetPpapiHost()->GetResourceHost(new_file_ref);
- if (!resource_host)
+ if (!resource_host) {
+ LOG(ERROR) << "Invalid resource host";
return PP_ERROR_BADRESOURCE;
+ }
PepperFileRefHost* file_ref_host = nullptr;
if (resource_host->IsFileRefHost())
file_ref_host = static_cast<PepperFileRefHost*>(resource_host);
- if (!file_ref_host)
+ if (!file_ref_host) {
+ LOG(ERROR) << "Invalid file ref host";
return PP_ERROR_BADRESOURCE;
+ }
rv = file_ref_host->CanCreate();
if (rv != PP_OK)
int32_t PepperFileRefHost::OnGetAbsolutePath(
ppapi::host::HostMessageContext* context) {
if (!host_->GetPpapiHost()->permissions().HasPermission(
- ppapi::PERMISSION_PRIVATE))
+ ppapi::PERMISSION_PRIVATE)) {
+ LOG(ERROR) << "Insufficient permission";
return PP_ERROR_NOACCESS;
+ }
return backend_->GetAbsolutePath(context->MakeReplyMessageContext());
}
#include "base/bind.h"
#include "base/callback.h"
+#include "base/logging.h"
#include "base/task/task_runner_util.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/threading/thread_task_runner_handle.h"
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileSystem_ReserveQuota,
OnHostMsgReserveQuota)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message not resolved";
return PP_ERROR_FAILED;
}
// Figure out why. Why is the file system size signed?
// Not allow multiple opens.
- if (called_open_)
+ if (called_open_) {
+ LOG(ERROR) << "Open has already been called - Not allow multiple opens";
return PP_ERROR_INPROGRESS;
+ }
called_open_ = true;
storage::FileSystemType file_system_type =
PepperFileSystemTypeToFileSystemType(type_);
- if (file_system_type == storage::kFileSystemTypeUnknown)
+ if (file_system_type == storage::kFileSystemTypeUnknown) {
+ LOG(ERROR) << "Unknown file system type";
return PP_ERROR_FAILED;
+ }
int render_process_id = 0;
int unused;
if (!browser_ppapi_host_->GetRenderFrameIDsForInstance(
pp_instance(), &render_process_id, &unused)) {
+ LOG(ERROR);
return PP_ERROR_FAILED;
}
const std::string& fsid,
PP_IsolatedFileSystemType_Private type) {
// Do not allow multiple opens.
- if (called_open_)
+ if (called_open_) {
+ LOG(ERROR) << "Open has already been called - Not allow multiple opens";
return PP_ERROR_INPROGRESS;
+ }
called_open_ = true;
// Do a sanity check.
- if (!storage::ValidateIsolatedFileSystemId(fsid))
+ if (!storage::ValidateIsolatedFileSystemId(fsid)) {
+ LOG(ERROR);
return PP_ERROR_BADARGUMENT;
+ }
int render_process_id = 0;
int unused;
if (!browser_ppapi_host_->GetRenderFrameIDsForInstance(
pp_instance(), &render_process_id, &unused)) {
storage::IsolatedContext::GetInstance()->RevokeFileSystem(fsid);
+ LOG(ERROR);
return PP_ERROR_FAILED;
}
DCHECK(ChecksQuota());
DCHECK_GT(amount, 0);
- if (reserving_quota_)
+ if (reserving_quota_) {
+ LOG(ERROR) << "Reserving quota in progress";
return PP_ERROR_INPROGRESS;
+ }
reserving_quota_ = true;
int64_t reservation_amount =
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_HostResolver_Resolve,
OnMsgResolve)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
&request,
render_process_id_,
render_frame_id_)) {
+ LOG(ERROR) << "Insufficient permissions";
return PP_ERROR_NOACCESS;
}
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_util.h"
+#include "base/logging.h"
#include "base/strings/escape.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/file_system/browser_file_system_helper.h"
int32_t PepperInternalFileRefBackend::MakeDirectory(
ppapi::host::ReplyMessageContext reply_context,
int32_t make_directory_flags) {
- if (!GetFileSystemURL().is_valid())
+ if (!GetFileSystemURL().is_valid()) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
-
+ }
bool exclusive = !!(make_directory_flags & PP_MAKEDIRECTORYFLAG_EXCLUSIVE);
bool recursive =
!!(make_directory_flags & PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS);
ppapi::host::ReplyMessageContext reply_context,
PP_Time last_access_time_in,
PP_Time last_modified_time_in) {
- if (!GetFileSystemURL().is_valid())
+ if (!GetFileSystemURL().is_valid()) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
-
+ }
base::Time last_access_time = ppapi::PPTimeToTime(last_access_time_in);
base::Time last_modified_time = ppapi::PPTimeToTime(last_modified_time_in);
GetIOThreadTaskRunner({})->PostTask(
int32_t PepperInternalFileRefBackend::Delete(
ppapi::host::ReplyMessageContext reply_context) {
- if (!GetFileSystemURL().is_valid())
+ if (!GetFileSystemURL().is_valid()) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
-
+ }
GetIOThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(
int32_t PepperInternalFileRefBackend::Rename(
ppapi::host::ReplyMessageContext reply_context,
PepperFileRefHost* new_file_ref) {
- if (!GetFileSystemURL().is_valid())
+ if (!GetFileSystemURL().is_valid()) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
storage::FileSystemURL new_url = new_file_ref->GetFileSystemURL();
- if (!new_url.is_valid())
+ if (!new_url.is_valid()) {
+ LOG(ERROR) << "Invalid new URL";
return PP_ERROR_FAILED;
- if (!new_url.IsInSameFileSystem(GetFileSystemURL()))
+ }
+ if (!new_url.IsInSameFileSystem(GetFileSystemURL())) {
+ LOG(ERROR) << "The new URL is not in same file system";
return PP_ERROR_FAILED;
-
+ }
storage::FileSystemOperationRunner::CopyOrMoveOptionSet options =
storage::FileSystemOperation::CopyOrMoveOptionSet();
GetIOThreadTaskRunner({})->PostTask(
int32_t PepperInternalFileRefBackend::Query(
ppapi::host::ReplyMessageContext reply_context) {
- if (!GetFileSystemURL().is_valid())
+ if (!GetFileSystemURL().is_valid()) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
int fields = storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY |
storage::FileSystemOperation::GET_METADATA_FIELD_SIZE |
int32_t PepperInternalFileRefBackend::ReadDirectoryEntries(
ppapi::host::ReplyMessageContext reply_context) {
- if (!GetFileSystemURL().is_valid())
+ if (!GetFileSystemURL().is_valid()) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
storage::FileSystemOperation::FileEntryList* accumulated_file_list =
new storage::FileSystemOperation::FileEntryList;
int32_t PepperInternalFileRefBackend::CanRead() const {
storage::FileSystemURL url = GetFileSystemURL();
- if (!FileSystemURLIsValid(GetFileSystemContext().get(), url))
+ if (!FileSystemURLIsValid(GetFileSystemContext().get(), url)) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFileSystemFile(
render_process_id_, url)) {
+ LOG(ERROR) << "Insufficient permissions - cannot read file system file";
return PP_ERROR_NOACCESS;
}
return PP_OK;
int32_t PepperInternalFileRefBackend::CanWrite() const {
storage::FileSystemURL url = GetFileSystemURL();
- if (!FileSystemURLIsValid(GetFileSystemContext().get(), url))
+ if (!FileSystemURLIsValid(GetFileSystemContext().get(), url)) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanWriteFileSystemFile(
render_process_id_, url)) {
+ LOG(ERROR) << "Insufficient permissions - cannot write to file system file";
return PP_ERROR_NOACCESS;
}
return PP_OK;
int32_t PepperInternalFileRefBackend::CanCreate() const {
storage::FileSystemURL url = GetFileSystemURL();
- if (!FileSystemURLIsValid(GetFileSystemContext().get(), url))
+ if (!FileSystemURLIsValid(GetFileSystemContext().get(), url)) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanCreateFileSystemFile(
render_process_id_, url)) {
+ LOG(ERROR) << "Insufficient permissions - cannot create file system file";
return PP_ERROR_NOACCESS;
}
return PP_OK;
int32_t PepperInternalFileRefBackend::CanReadWrite() const {
storage::FileSystemURL url = GetFileSystemURL();
- if (!FileSystemURLIsValid(GetFileSystemContext().get(), url))
+ if (!FileSystemURLIsValid(GetFileSystemContext().get(), url)) {
+ LOG(ERROR) << "Invalid file system URL";
return PP_ERROR_FAILED;
+ }
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
if (!policy->CanReadFileSystemFile(render_process_id_, url) ||
!policy->CanWriteFileSystemFile(render_process_id_, url)) {
+ LOG(ERROR)
+ << "Insufficient permissions: cannot read or write to file system file";
return PP_ERROR_NOACCESS;
}
return PP_OK;
#include "content/browser/renderer_host/pepper/pepper_network_proxy_host.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
#include "content/browser/renderer_host/pepper/pepper_proxy_lookup_helper.h"
#include "content/browser/renderer_host/pepper/pepper_socket_utils.h"
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_NetworkProxy_GetProxyForURL,
OnMsgGetProxyForURL)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message not resolved";
return PP_ERROR_FAILED;
}
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/c/dev/pp_print_settings_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h"
PpapiHostMsg_Printing_GetDefaultPrintSettings,
OnGetDefaultPrintSettings)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
PpapiHostMsg_TCPServerSocket_StopListening, OnMsgStopListening)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
&request,
render_process_id_,
render_frame_id_)) {
+ LOG(ERROR) << "Insufficient permissions";
return PP_ERROR_NOACCESS;
}
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(context);
- if (state_ != STATE_LISTENING)
+ if (state_ != STATE_LISTENING) {
+ LOG(ERROR) << "Socket not listening";
return PP_ERROR_FAILED;
+ }
state_ = STATE_ACCEPT_IN_PROGRESS;
ppapi::host::ReplyMessageContext reply_context(
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_TCPSocket_SetOption,
OnMsgSetOption)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
// This is only supported by PPB_TCPSocket v1.1 or above.
if (version_ != ppapi::TCP_SOCKET_VERSION_1_1_OR_ABOVE) {
+ LOG(ERROR) << "Supported only by PPB_TCPSocket v1.1 or above";
NOTREACHED();
return PP_ERROR_NOACCESS;
}
if (!pepper_socket_utils::CanUseSocketAPIs(
external_plugin_, false /* private_api */, nullptr,
render_process_id_, render_frame_id_)) {
+ LOG(ERROR) << "Cannot use Socket APIs";
return PP_ERROR_NOACCESS;
}
// This is only supported by PPB_TCPSocket_Private.
if (!IsPrivateAPI()) {
NOTREACHED();
+ LOG(ERROR) << "Supported only by PPB_TCPSocket_Private";
return PP_ERROR_NOACCESS;
}
if (!pepper_socket_utils::CanUseSocketAPIs(
external_plugin_, true /* private_api */, &request,
render_process_id_, render_frame_id_)) {
+ LOG(ERROR) << "Insufficient permissions";
return PP_ERROR_NOACCESS;
}
if (!pepper_socket_utils::CanUseSocketAPIs(external_plugin_, IsPrivateAPI(),
&request, render_process_id_,
render_frame_id_)) {
+ LOG(ERROR) << "Insufficient permissions: Cannot connect with NetAddress";
return PP_ERROR_NOACCESS;
}
// and there isn't pending read or write.
if (!state_.IsValidTransition(TCPSocketState::SSL_CONNECT) ||
pending_read_context_.is_valid() || pending_write_context_.is_valid()) {
+ LOG(ERROR) << "Socket not connected or pending read or write";
return PP_ERROR_FAILED;
}
// This only covers the case where the socket was explicitly closed from the
// caller, or the filter is being destroyed. Read errors and Mojo errors are
// handled in TryRead().
- if (!state_.IsConnected())
+ if (!state_.IsConnected()) {
+ LOG(ERROR) << "Not connected";
return PP_ERROR_FAILED;
-
+ }
if (pending_read_context_.is_valid())
return PP_ERROR_INPROGRESS;
if (bytes_to_read <= 0 ||
bytes_to_read > TCPSocketResourceConstants::kMaxReadSize) {
+ LOG(ERROR) << "Incorrect number of bytes to read - " << bytes_to_read
+ << " Should be <= " << TCPSocketResourceConstants::kMaxReadSize
+ << " and > 0";
return PP_ERROR_BADARGUMENT;
}
const ppapi::DataView& data) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (!state_.IsConnected())
+ if (!state_.IsConnected()) {
+ LOG(ERROR) << "Not connected";
return PP_ERROR_FAILED;
+ }
if (pending_write_context_.is_valid())
return PP_ERROR_INPROGRESS;
if (data_size == 0 ||
data_size >
static_cast<size_t>(TCPSocketResourceConstants::kMaxWriteSize)) {
+ LOG(ERROR) << "Invalid data size - " << data_size << " should be <= "
+ << static_cast<size_t>(TCPSocketResourceConstants::kMaxWriteSize)
+ << " and != 0";
return PP_ERROR_BADARGUMENT;
}
// This is only supported by PPB_TCPSocket v1.1 or above.
if (version_ != ppapi::TCP_SOCKET_VERSION_1_1_OR_ABOVE) {
+ LOG(ERROR) << "Supported only by PPB_TCPSocket v1.1 or above";
NOTREACHED();
return PP_ERROR_NOACCESS;
}
if (!pepper_socket_utils::CanUseSocketAPIs(
external_plugin_, false /* private_api */, &request,
render_process_id_, render_frame_id_)) {
+ LOG(ERROR) << "Insufficient permissions";
return PP_ERROR_NOACCESS;
}
const ppapi::host::HostMessageContext* context) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (pending_accept_)
+ if (pending_accept_) {
+ LOG(WARNING) << "Pending accept";
return PP_ERROR_INPROGRESS;
- if (state_.state() != TCPSocketState::LISTENING)
+ }
+ if (state_.state() != TCPSocketState::LISTENING) {
+ LOG(ERROR) << "Invalid socket state: " << static_cast<int>(state_.state());
return PP_ERROR_FAILED;
-
+ }
DCHECK(server_socket_);
pending_accept_ = true;
switch (name) {
case PP_TCPSOCKET_OPTION_NO_DELAY: {
bool boolean_value = false;
- if (!value.GetBool(&boolean_value))
+ if (!value.GetBool(&boolean_value)) {
+ LOG(ERROR) << "Invalid socket option";
return PP_ERROR_BADARGUMENT;
-
+ }
// If |connected_socket_| is connecting or has connected, pass the setting
// along.
if (connected_socket_.is_bound()) {
case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE: {
int32_t integer_value = 0;
if (!value.GetInt32(&integer_value) || integer_value <= 0 ||
- integer_value > TCPSocketResourceConstants::kMaxSendBufferSize)
+ integer_value > TCPSocketResourceConstants::kMaxSendBufferSize) {
+ LOG(ERROR) << "Invalid send buffer size value - " << integer_value
+ << " should be <= "
+ << TCPSocketResourceConstants::kMaxSendBufferSize
+ << " and > 0";
return PP_ERROR_BADARGUMENT;
+ }
// If |connected_socket_| is connecting or has connected, pass the setting
// along.
case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: {
int32_t integer_value = 0;
if (!value.GetInt32(&integer_value) || integer_value <= 0 ||
- integer_value > TCPSocketResourceConstants::kMaxReceiveBufferSize)
+ integer_value > TCPSocketResourceConstants::kMaxReceiveBufferSize) {
+ LOG(ERROR) << "Invalid receive buffer size - " << integer_value
+ << " should be <= "
+ << TCPSocketResourceConstants::kMaxReceiveBufferSize
+ << " and > 0";
return PP_ERROR_BADARGUMENT;
+ }
// If |connected_socket_| is connecting or has connected, pass the setting
// along.
return PP_OK;
}
default: {
+ LOG(ERROR);
NOTREACHED();
return PP_ERROR_BADARGUMENT;
}
#include "content/browser/renderer_host/pepper/pepper_truetype_font_host.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "base/task/task_runner_util.h"
#include "base/task/thread_pool.h"
#include "content/browser/renderer_host/pepper/pepper_truetype_font.h"
int32_t PepperTrueTypeFontHost::OnResourceMessageReceived(
const IPC::Message& msg,
HostMessageContext* context) {
- if (!host()->permissions().HasPermission(ppapi::PERMISSION_DEV))
+ if (!host()->permissions().HasPermission(ppapi::PERMISSION_DEV)) {
+ LOG(ERROR) << "No dev permission. Permission denied";
return PP_ERROR_FAILED;
+ }
PPAPI_BEGIN_MESSAGE_MAP(PepperTrueTypeFontHost, msg)
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_TrueTypeFont_GetTableTags,
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_TrueTypeFont_GetTable,
OnHostMsgGetTable)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
int32_t PepperTrueTypeFontHost::OnHostMsgGetTableTags(
HostMessageContext* context) {
- if (!font_.get())
+ if (!font_.get()) {
+ LOG(ERROR) << "Font not found";
return PP_ERROR_FAILED;
+ }
// Get font data on a thread that allows slow blocking operations.
std::vector<uint32_t>* tags = new std::vector<uint32_t>();
uint32_t table,
int32_t offset,
int32_t max_data_length) {
- if (!font_.get())
+ if (!font_.get()) {
+ LOG(ERROR) << "Font not found";
return PP_ERROR_FAILED;
- if (offset < 0 || max_data_length < 0)
+ }
+ if (offset < 0 || max_data_length < 0) {
+ LOG(ERROR) << "Offset should be greater or equal to 0, offset=" << offset
+ << " Max data length should be greater or equal to 0,"
+ << " max_data_length=" << max_data_length;
return PP_ERROR_BADARGUMENT;
+ }
// Get font data on a thread that allows slow blocking operations.
std::string* data = new std::string();
#include <algorithm>
+#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "content/browser/renderer_host/pepper/pepper_truetype_font_list.h"
#include "content/common/font_list.h"
PpapiHostMsg_TrueTypeFontSingleton_GetFontsInFamily,
OnHostMsgGetFontsInFamily)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
#include <memory>
#include "base/check.h"
+#include "base/logging.h"
#include "content/common/pepper_file_util.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
socket_for_create_callback_->handle());
return PP_OK;
}
+ LOG(ERROR) << "Cannot get sync socket";
return PP_ERROR_FAILED;
}
*shm = &shared_memory_for_create_callback_;
return PP_OK;
}
+ LOG(ERROR) << "Cannot get shared memory";
return PP_ERROR_FAILED;
}
if (!shm.IsValid())
return false;
+ HostGlobals* hg = HostGlobals::Get();
+ PluginModule* pm = hg->GetModule(hg->GetModuleForInstance(instance));
+ if (!pm)
+ return false;
+
base::WritableSharedMemoryMapping shm_mapping = shm.MapAt(0, ByteLength());
if (!shm_mapping.IsValid())
return false;
// Duplicate the handle here; the UnsafeSharedMemoryRegion destructor closes
// its handle on us.
- HostGlobals* hg = HostGlobals::Get();
- PluginModule* pm = hg->GetModule(hg->GetModuleForInstance(instance));
*plugin_shm_region =
pm->renderer_ppapi_host()->ShareUnsafeSharedMemoryRegionWithRemote(shm);
namespace content {
-HostResourceVar::HostResourceVar() : pp_resource_(0) {}
+HostResourceVar::HostResourceVar()
+ : pp_resource_(0),
+ pending_renderer_host_id_(0),
+ pending_browser_host_id_(0) {}
HostResourceVar::HostResourceVar(PP_Resource pp_resource)
: pp_resource_(pp_resource),
OnStartOrStop)
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_AudioInput_Close, OnClose)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
const std::string& device_id,
PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) {
- if (open_context_.is_valid())
+ if (open_context_.is_valid()) {
+ LOG(ERROR) << "Invalid open context";
return PP_ERROR_INPROGRESS;
- if (audio_input_)
+ }
+ if (audio_input_) {
+ LOG(ERROR) << "Audio input is not NULL";
return PP_ERROR_FAILED;
+ }
GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance());
- if (!document_url.is_valid())
+ if (!document_url.is_valid()) {
+ LOG(ERROR) << "Invalid document URL";
return PP_ERROR_FAILED;
+ }
// When it is done, we'll get called back on StreamCreated() or
// StreamCreationFailed().
open_context_ = context->MakeReplyMessageContext();
return PP_OK_COMPLETIONPENDING;
} else {
+ LOG(ERROR) << "Audio input is NULL";
return PP_ERROR_FAILED;
}
}
int32_t PepperAudioInputHost::OnStartOrStop(
ppapi::host::HostMessageContext* /* context */,
bool capture) {
- if (!audio_input_)
+ if (!audio_input_) {
+ LOG(ERROR) << "Audio input is NULL";
return PP_ERROR_FAILED;
+ }
if (capture)
audio_input_->StartCapture();
else
base::ReadOnlySharedMemoryRegion* remote_shared_memory_region) {
*remote_socket_handle =
renderer_ppapi_host_->ShareHandleWithRemote(socket.handle(), false);
- if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit())
+ if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit()) {
+ LOG(ERROR) << "Invalid platform file for transit";
return PP_ERROR_FAILED;
+ }
*remote_shared_memory_region =
renderer_ppapi_host_->ShareReadOnlySharedMemoryRegionWithRemote(
shared_memory_region);
- if (!remote_shared_memory_region->IsValid())
+ if (!remote_shared_memory_region->IsValid()) {
+ LOG(ERROR) << "Invalid region for shared memory";
return PP_ERROR_FAILED;
+ }
return PP_OK;
}
#include "content/renderer/pepper/pepper_camera_device_host.h"
#include <memory>
-
+#include "base/logging.h"
#include "content/public/renderer/render_frame.h"
#include "content/renderer/pepper/pepper_platform_camera_device.h"
#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
int32_t PepperCameraDeviceHost::OnOpen(ppapi::host::HostMessageContext* context,
const std::string& device_id) {
- if (open_reply_context_.is_valid())
+ if (open_reply_context_.is_valid()) {
+ LOG(ERROR) << "Invalid open reply context";
return PP_ERROR_INPROGRESS;
+ }
- if (platform_camera_device_.get())
+ if (platform_camera_device_.get()) {
+ LOG(ERROR) << "Platform camera device is NULL";
return PP_ERROR_FAILED;
+ }
GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance());
- if (!document_url.is_valid())
+ if (!document_url.is_valid()) {
+ LOG(ERROR) << "Invalid document URL";
return PP_ERROR_FAILED;
+ }
platform_camera_device_ = std::make_unique<PepperPlatformCameraDevice>(
renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance())
int32_t PepperCameraDeviceHost::OnGetSupportedVideoCaptureFormats(
ppapi::host::HostMessageContext* context) {
- if (video_capture_formats_reply_context_.is_valid())
+ if (video_capture_formats_reply_context_.is_valid()) {
+ LOG(ERROR) << "Invalid video capture formats reply context";
return PP_ERROR_INPROGRESS;
- if (!platform_camera_device_)
+ }
+ if (!platform_camera_device_) {
+ LOG(ERROR) << "Platform camera device is NULL";
return PP_ERROR_FAILED;
+ }
video_capture_formats_reply_context_ = context->MakeReplyMessageContext();
platform_camera_device_->GetSupportedVideoCaptureFormats();
PPAPI_END_MESSAGE_MAP()
*handled = false;
+ LOG(ERROR) << "Cannot handle internal resource message";
return PP_ERROR_FAILED;
}
int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices(
HostMessageContext* context) {
- if (enumerate_devices_context_.is_valid())
+ if (enumerate_devices_context_.is_valid()) {
+ LOG(ERROR) << "Invalid enumerate devices context";
return PP_ERROR_INPROGRESS;
+ }
enumerate_ = std::make_unique<ScopedEnumerationRequest>(
this, base::BindOnce(
&PepperDeviceEnumerationHostHelper::OnEnumerateDevicesComplete,
base::Unretained(this)));
- if (!enumerate_->requested())
+ if (!enumerate_->requested()) {
+ LOG(ERROR) << "Cannot request enumerate";
return PP_ERROR_FAILED;
+ }
enumerate_devices_context_ = context->MakeReplyMessageContext();
return PP_OK_COMPLETIONPENDING;
#include "base/bind.h"
#include "base/files/file_path.h"
+#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "content/renderer/pepper/pepper_file_ref_renderer_host.h"
PPAPI_BEGIN_MESSAGE_MAP(PepperFileChooserHost, msg)
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileChooser_Show, OnShow)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
bool open_multiple,
const std::string& suggested_file_name,
const std::vector<std::string>& accept_mime_types) {
- if (handler_)
+ if (handler_) {
+ LOG(ERROR) << "Show already pending";
return PP_ERROR_INPROGRESS; // Already pending.
+ }
if (!host()->permissions().HasPermission(
ppapi::PERMISSION_BYPASS_USER_GESTURE) &&
!renderer_ppapi_host_->HasUserGesture(pp_instance())) {
+ LOG(ERROR) << "No user gesture";
return PP_ERROR_NO_USER_GESTURE;
}
if (!handler_->OpenFileChooser(render_frame, std::move(params))) {
delete handler_;
handler_ = nullptr;
+ LOG(ERROR);
return PP_ERROR_NOACCESS;
}
#include <string>
+#include "base/logging.h"
#include "base/strings/escape.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/ppapi_host.h"
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) {
// We don't handle any messages from the plugin in this host.
+ LOG(ERROR) << "Resource message unresolved";
NOTREACHED();
return PP_ERROR_FAILED;
}
PpapiHostMsg_FileSystem_InitIsolatedFileSystem,
OnHostMsgInitIsolatedFileSystem)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
ppapi::host::HostMessageContext* context,
int64_t expected_size) {
// Not allow multiple opens.
- if (called_open_)
+ if (called_open_) {
+ LOG(ERROR) << "Already an open called - not allow multiple opens";
return PP_ERROR_INPROGRESS;
+ }
called_open_ = true;
absl::optional<blink::mojom::FileSystemType> file_system_type =
PepperFileSystemTypeToMojoFileSystemType(type_);
- if (!file_system_type.has_value())
+ if (!file_system_type.has_value()) {
+ LOG(ERROR) << "Unknown file system type";
return PP_ERROR_FAILED;
+ }
GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance());
- if (!document_url.is_valid())
+ if (!document_url.is_valid()) {
+ LOG(ERROR) << "Invalid document URL";
return PP_ERROR_FAILED;
+ }
reply_context_ = context->MakeReplyMessageContext();
blink::mojom::FileSystemManager* file_system_manager = GetFileSystemManager();
const std::string& fsid,
PP_IsolatedFileSystemType_Private type) {
// Do not allow multiple opens.
- if (called_open_)
+ if (called_open_) {
+ LOG(ERROR) << "Already an open called - not allow multiple opens";
return PP_ERROR_INPROGRESS;
+ }
called_open_ = true;
// Do a sanity check.
- if (!storage::ValidateIsolatedFileSystemId(fsid))
+ if (!storage::ValidateIsolatedFileSystemId(fsid)) {
+ LOG(ERROR) << "Cannot validate isolated file system ID";
return PP_ERROR_BADARGUMENT;
+ }
RenderFrame* frame =
renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance());
- if (!frame)
+ if (!frame) {
+ LOG(ERROR) << "Cannot get render view";
return PP_ERROR_FAILED;
+ }
url::Origin main_frame_origin(
frame->GetWebView()->MainFrame()->GetSecurityOrigin());
const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type);
- if (root_name.empty())
+ if (root_name.empty()) {
+ LOG(ERROR) << "Cannot get isolated file system root name";
return PP_ERROR_BADARGUMENT;
+ }
root_url_ = GURL(storage::GetIsolatedFileSystemRootURIString(
main_frame_origin.GetURL(), fsid, root_name));
opened_ = true;
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_ReadImageData,
OnHostMsgReadImageData)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
const PP_Rect& src_rect) {
EnterResourceNoLock<PPB_ImageData_API> enter(image_data.host_resource(),
true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter ImageData failed";
return PP_ERROR_BADRESOURCE;
+ }
PPB_ImageData_Impl* image_resource =
static_cast<PPB_ImageData_Impl*>(enter.object());
operation.paint_image = image_resource;
if (!ValidateAndConvertRect(src_rect_specified ? &src_rect : nullptr,
image_resource->width(), image_resource->height(),
- &operation.paint_src_rect))
+ &operation.paint_src_rect)) {
+ LOG(ERROR) << "ValidateAndConvertRect failed";
return PP_ERROR_BADARGUMENT;
+ }
// Validate the bitmap position using the previously-validated rect, there
// should be no painted area outside of the image.
int64_t y64 = static_cast<int64_t>(top_left.y);
if (x64 + static_cast<int64_t>(operation.paint_src_rect.x()) < 0 ||
x64 + static_cast<int64_t>(operation.paint_src_rect.right()) >
- image_data_->width())
+ image_data_->width()) {
+ LOG(ERROR) << "Wrong horizontal position to be painted, position value: "
+ << x64 + static_cast<int64_t>(operation.paint_src_rect.x())
+ << " should be greater or equal to 0 and size value: "
+ << x64 + static_cast<int64_t>(operation.paint_src_rect.right())
+ << " should be less or equal to " << image_data_->width();
return PP_ERROR_BADARGUMENT;
+ }
if (y64 + static_cast<int64_t>(operation.paint_src_rect.y()) < 0 ||
y64 + static_cast<int64_t>(operation.paint_src_rect.bottom()) >
- image_data_->height())
+ image_data_->height()) {
+ LOG(ERROR) << "Wrong vertical position to be painted:, position value "
+ << y64 + static_cast<int64_t>(operation.paint_src_rect.y())
+ << " should be greater or equal to 0 and size value: "
+ << y64 + static_cast<int64_t>(operation.paint_src_rect.bottom())
+ << " should be less or equal to " << image_data_->height();
return PP_ERROR_BADARGUMENT;
+ }
operation.paint_x = top_left.x;
operation.paint_y = top_left.y;
QueuedOperation operation(QueuedOperation::SCROLL);
if (!ValidateAndConvertRect(clip_specified ? &clip : nullptr,
image_data_->width(), image_data_->height(),
- &operation.scroll_clip_rect))
+ &operation.scroll_clip_rect)) {
+ LOG(ERROR) << "ValidateAndConvertRect failed";
return PP_ERROR_BADARGUMENT;
+ }
// If we're being asked to scroll by more than the clip rect size, just
// ignore this scroll command and say it worked.
int32_t dx = amount.x;
int32_t dy = amount.y;
if (dx <= -image_data_->width() || dx >= image_data_->width() ||
- dy <= -image_data_->height() || dy >= image_data_->height())
+ dy <= -image_data_->height() || dy >= image_data_->height()) {
+ LOG(ERROR) << "Scrolling amount greater than clip rect size: Absolute value"
+ << " of x= " << dx << " should be less than "
+ << image_data_->width() << "and absolute value of y= " << dy
+ << " should be less than " << image_data_->height();
return PP_ERROR_BADARGUMENT;
+ }
operation.scroll_dx = dx;
operation.scroll_dy = dy;
const ppapi::HostResource& image_data) {
EnterResourceNoLock<PPB_ImageData_API> enter(image_data.host_resource(),
true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter ImageData failed";
return PP_ERROR_BADRESOURCE;
+ }
PPB_ImageData_Impl* image_resource =
static_cast<PPB_ImageData_Impl*>(enter.object());
- if (!PPB_ImageData_Impl::IsImageDataFormatSupported(image_resource->format()))
+ if (!PPB_ImageData_Impl::IsImageDataFormatSupported(
+ image_resource->format())) {
+ LOG(ERROR) << "Unsupported image data format: "
+ << static_cast<int>(image_resource->format());
return PP_ERROR_BADARGUMENT;
+ }
if (image_resource->width() != image_data_->width() ||
- image_resource->height() != image_data_->height())
+ image_resource->height() != image_data_->height()) {
+ LOG(ERROR) << "Different widths or heights between image resource and"
+ << " image data, image resource (width, height) = ("
+ << image_resource->width() << ", " << image_resource->height()
+ << "), image data (width, height) = (" << image_data_->width()
+ << ", " << image_data_->height() << ")";
return PP_ERROR_BADARGUMENT;
+ }
QueuedOperation operation(QueuedOperation::REPLACE);
operation.replace_image = image_resource;
int32_t PepperGraphics2DHost::OnHostMsgFlush(
ppapi::host::HostMessageContext* context) {
// Don't allow more than one pending flush at a time.
- if (HasPendingFlush())
+ if (HasPendingFlush()) {
+ LOG(ERROR) << "Flush is pending";
return PP_ERROR_INPROGRESS;
+ }
PP_Resource old_image_data = 0;
flush_reply_context_ = context->MakeReplyMessageContext();
scale_ = scale;
return PP_OK;
}
+ LOG(ERROR) << "Scale cannot be negative or zero: " << scale;
return PP_ERROR_BADARGUMENT;
}
active_buffers_generation_(0),
active_buffer_frame_offset_(0),
buffers_generation_(0),
+ output_buffer_size_(0),
main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
number_of_buffers_(kDefaultNumberOfAudioBuffers),
bytes_per_second_(0),
DCHECK_EQ(main_task_runner_, base::ThreadTaskRunnerHandle::Get());
if (pending_configure_reply_.is_valid()) {
+ LOG(ERROR) << "Invalid ending reply context";
return PP_ERROR_INPROGRESS;
}
pending_configure_reply_ = context;
int32_t PepperMediaStreamAudioTrackHost::OnHostMsgConfigure(
HostMessageContext* context,
const MediaStreamAudioTrackShared::Attributes& attributes) {
- if (!MediaStreamAudioTrackShared::VerifyAttributes(attributes))
+ if (!MediaStreamAudioTrackShared::VerifyAttributes(attributes)) {
+ LOG(ERROR) << "Invalid attributes";
return PP_ERROR_BADARGUMENT;
+ }
int32_t buffers = attributes.buffers
? std::min(kMaxNumberOfAudioBuffers, attributes.buffers)
const PPP_MessageHandler_0_2* handler,
PP_Resource message_loop) {
// Not supported in-process.
+ LOG(ERROR) << "Not supported in-process";
NOTIMPLEMENTED();
return PP_ERROR_FAILED;
}
int32_t PepperPluginInstanceImpl::LockMouse(
PP_Instance instance,
scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(lock_mouse_callback_))
+ if (TrackedCallback::IsPending(lock_mouse_callback_)) {
+ LOG(ERROR) << "Lock mouse callback is pending";
return PP_ERROR_INPROGRESS;
+ }
if (IsMouseLocked())
return PP_OK;
- if (!CanAccessMainFrame())
+ if (!CanAccessMainFrame()) {
+ LOG(ERROR) << "Cannot access main frame";
return PP_ERROR_NOACCESS;
+ }
- if (!HasTransientUserActivation())
+ if (!HasTransientUserActivation()) {
+ LOG(ERROR) << "Not have TransientUserActivation";
return PP_ERROR_NO_USER_GESTURE;
+ }
- if (!LockMouse(false))
+ if (!LockMouse(false)) {
+ LOG(ERROR) << "Locking mouse failed";
return PP_ERROR_FAILED;
+ }
lock_mouse_callback_ = callback;
return PP_OK_COMPLETIONPENDING;
#include <stddef.h>
#include "base/feature_list.h"
+#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h"
#include "content/public/common/content_features.h"
PpapiHostMsg_URLLoader_GrantUniversalAccess,
OnHostMsgGrantUniversalAccess)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
const ppapi::URLRequestInfoData& request_data) {
// Main document loads are already open, so don't allow people to open them
// again.
- if (main_document_loader_)
+ if (main_document_loader_) {
+ LOG(ERROR) << "Main document already opened - not allow to multiple opens";
return PP_ERROR_INPROGRESS;
+ }
// Create a copy of the request data since CreateWebURLRequest will populate
// the file refs.
" on a different security origin than your plugin. To request "
" cross-origin resources, see "
" PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS.");
+ LOG(ERROR) << "The URL you're requesting is on a different security"
+ << " origin than your plugin";
return PP_ERROR_NOACCESS;
}
- if (loader_.get())
+ if (loader_.get()) {
+ LOG(ERROR) << "Open already in progress";
return PP_ERROR_INPROGRESS;
+ }
WebLocalFrame* frame = GetFrame();
- if (!frame)
+ if (!frame) {
+ LOG(ERROR) << "Frame is NULL";
return PP_ERROR_FAILED;
+ }
WebURLRequest web_request;
if (!CreateWebURLRequest(
pp_instance(), &filled_in_request_data, frame, &web_request)) {
+ LOG(ERROR) << "Cannot create WebURLRequest";
return PP_ERROR_FAILED;
}
}
loader_ = frame->CreateAssociatedURLLoader(options);
- if (!loader_.get())
+ if (!loader_.get()) {
+ LOG(ERROR) << "Unsuccessful creation of AssociatedURLLoader";
return PP_ERROR_FAILED;
+ }
// Don't actually save the request until we know we're going to load.
request_data_ = filled_in_request_data;
has_universal_access_ = true;
return PP_OK;
}
+ LOG(ERROR) << "Only plugins with permission can bypass same origin";
return PP_ERROR_FAILED;
}
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoCapture_Close,
OnClose)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
const std::string& device_id,
const PP_VideoCaptureDeviceInfo_Dev& requested_info,
uint32_t buffer_count) {
- if (platform_video_capture_.get())
+ if (platform_video_capture_.get()) {
+ LOG(ERROR) << "Platform video capture is not NULL";
return PP_ERROR_FAILED;
+ }
SetRequestedInfo(requested_info, buffer_count);
GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance());
- if (!document_url.is_valid())
+ if (!document_url.is_valid()) {
+ LOG(ERROR) << "Invalid document URL";
return PP_ERROR_FAILED;
+ }
platform_video_capture_ = std::make_unique<PepperPlatformVideoCapture>(
renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance())
int32_t PepperVideoCaptureHost::OnStartCapture(
ppapi::host::HostMessageContext* context) {
if (!SetStatus(PP_VIDEO_CAPTURE_STATUS_STARTING, false) ||
- !platform_video_capture_.get())
+ !platform_video_capture_.get()) {
+ LOG(ERROR) << "Cannot set PP_VIDEO_CAPTURE_STATUS_STARTING status or "
+ << "platform video capture is NULL";
return PP_ERROR_FAILED;
+ }
DCHECK(buffers_.empty());
int32_t PepperVideoCaptureHost::OnReuseBuffer(
ppapi::host::HostMessageContext* context,
uint32_t buffer) {
- if (buffer >= buffers_.size() || !buffers_[buffer].in_use)
+ if (buffer >= buffers_.size() || !buffers_[buffer].in_use) {
+ LOG(ERROR) << "Wrong buffer ID: " << buffer << "Should be less than "
+ << buffers_.size() << " and should be in use, buffer.in_use ="
+ << buffers_[buffer].in_use;
return PP_ERROR_BADARGUMENT;
+ }
buffers_[buffer].in_use = false;
return PP_OK;
}
}
int32_t PepperVideoCaptureHost::StopCapture() {
- if (!SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPING, false))
+ if (!SetStatus(PP_VIDEO_CAPTURE_STATUS_STOPPING, false)) {
+ LOG(ERROR) << "Cannot set PP_VIDEO_CAPTURE_STATUS_STOPPING status";
return PP_ERROR_FAILED;
+ }
DCHECK(platform_video_capture_.get());
const std::vector<gpu::Mailbox>& mailboxes) {
if (!initialized_)
return PP_ERROR_FAILED;
- if (texture_ids.size() != mailboxes.size())
+ if (texture_ids.size() != mailboxes.size()) {
+ LOG(ERROR) << "Texture_ids size was invalid";
return PP_ERROR_FAILED;
+ }
DCHECK(decoder_);
pending_texture_requests_--;
// Non-owning pointer.
RendererPpapiHost* renderer_ppapi_host_;
- media::VideoCodecProfile profile_;
+ media::VideoCodecProfile profile_ = media::VIDEO_CODEC_PROFILE_UNKNOWN;
std::unique_ptr<media::VideoDecodeAccelerator> decoder_;
// writable before sending a read-only region back to the host.
std::vector<MappedBuffer> shm_buffers_;
- uint32_t min_picture_count_;
+ uint32_t min_picture_count_ = 0;
typedef std::map<uint32_t, PictureBufferState> PictureBufferMap;
PictureBufferMap picture_buffer_map_;
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/numerics/safe_math.h"
#include "base/threading/thread_task_runner_handle.h"
media::VideoEncodeAccelerator::Error error) {
switch (error) {
case media::VideoEncodeAccelerator::kInvalidArgumentError:
+ LOG(ERROR) << "Invalid Argument in VideoEncodeAccelerator";
return PP_ERROR_MALFORMED_INPUT;
case media::VideoEncodeAccelerator::kIllegalStateError:
+ LOG(ERROR) << "VideoEncodeAccelerator in illegal state";
+ return PP_ERROR_RESOURCE_FAILED;
case media::VideoEncodeAccelerator::kPlatformFailureError:
+ LOG(ERROR) << "Platform Failure in VideoEncodeAccelerator";
return PP_ERROR_RESOURCE_FAILED;
// No default case, to catch unhandled enum values.
}
+ LOG(ERROR);
return PP_ERROR_FAILED;
}
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_VideoEncoder_Close,
OnHostMsgClose)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
PP_VideoProfile output_profile,
uint32_t initial_bitrate,
PP_HardwareAcceleration acceleration) {
- if (initialized_)
+ if (initialized_) {
+ LOG(ERROR) << "Encoder already initialized";
return PP_ERROR_FAILED;
+ }
media_input_format_ = PP_ToMediaVideoFormat(input_format);
- if (media_input_format_ == media::PIXEL_FORMAT_UNKNOWN)
+ if (media_input_format_ == media::PIXEL_FORMAT_UNKNOWN) {
+ LOG(ERROR) << "Unknown pixel format";
return PP_ERROR_BADARGUMENT;
+ }
media::VideoCodecProfile media_profile =
PP_ToMediaVideoProfile(output_profile);
- if (media_profile == media::VIDEO_CODEC_PROFILE_UNKNOWN)
+ if (media_profile == media::VIDEO_CODEC_PROFILE_UNKNOWN) {
+ LOG(ERROR) << "Unknown codec profile";
return PP_ERROR_BADARGUMENT;
+ }
gfx::Size input_size(input_visible_size.width, input_visible_size.height);
- if (input_size.IsEmpty())
+ if (input_size.IsEmpty()) {
+ LOG(ERROR) << "Input size is empty";
return PP_ERROR_BADARGUMENT;
+ }
if (acceleration == PP_HARDWAREACCELERATION_ONLY)
return PP_ERROR_NOTSUPPORTED;
if (encoder_last_error_)
return encoder_last_error_;
- if (frame_id >= frame_count_)
+ if (frame_id >= frame_count_) {
+ LOG(ERROR) << "The frame ID = " << frame_id << " cannot be larger or "
+ << "equal to " << frame_count_;
return PP_ERROR_FAILED;
+ }
encoder_->Encode(
CreateVideoFrame(frame_id, context->MakeReplyMessageContext()),
if (encoder_last_error_)
return encoder_last_error_;
- if (buffer_id >= shm_buffers_.size() || shm_buffers_[buffer_id]->in_use)
+ if (buffer_id >= shm_buffers_.size() || shm_buffers_[buffer_id]->in_use) {
+ LOG(ERROR) << "Wrong buffer ID = " << buffer_id << ", should be less than"
+ << shm_buffers_.size() << " and not in use, buffer.in_use = "
+ << shm_buffers_[buffer_id]->in_use;
return PP_ERROR_FAILED;
+ }
shm_buffers_[buffer_id]->in_use = true;
encoder_->UseOutputBitstreamBuffer(
#include <string>
+#include "base/logging.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "net/base/port_util.h"
#include "ppapi/c/pp_errors.h"
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Fail,
OnHostMsgFail)
PPAPI_END_MESSAGE_MAP()
+ LOG(ERROR) << "Resource message unresolved";
return PP_ERROR_FAILED;
}
// Validate url and convert it to WebURL.
GURL gurl(url);
url_ = gurl.spec();
- if (!gurl.is_valid())
+ if (!gurl.is_valid()) {
+ LOG(ERROR) << "Invalid URL";
return PP_ERROR_BADARGUMENT;
- if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss"))
+ }
+ if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss")) {
+ LOG(ERROR) << "Invalid scheme of the URL";
return PP_ERROR_BADARGUMENT;
- if (gurl.has_ref())
+ }
+ if (gurl.has_ref()) {
+ LOG(ERROR) << "The URL has ref";
return PP_ERROR_BADARGUMENT;
+ }
if (!net::IsPortAllowedForScheme(gurl.EffectiveIntPort(),
- gurl.scheme_piece()))
+ gurl.scheme_piece())) {
+ LOG(ERROR) << "Chosen port is not allowed for scheme";
return PP_ERROR_BADARGUMENT;
+ }
WebURL web_url(gurl);
// Validate protocols.
character == '/' ||
(character >= ':' && character <= '@') || // U+003A - U+0040
(character >= '[' && character <= ']') || // U+005B - u+005D
- character == '{' ||
- character == '}')
+ character == '{' || character == '}') {
+ LOG(ERROR) << "Incorrect character";
return PP_ERROR_BADARGUMENT;
+ }
}
// Join protocols with the comma separator.
if (vector_it != protocols.begin())
// Create blink::WebSocket object and connect.
blink::WebPluginContainer* container =
renderer_ppapi_host_->GetContainerForInstance(pp_instance());
- if (!container)
+ if (!container) {
+ LOG(ERROR) << "Invalid WebPluginContainer";
return PP_ERROR_BADARGUMENT;
+ }
websocket_ = WebPepperSocket::Create(container->GetDocument(), this);
DCHECK(websocket_.get());
- if (!websocket_)
+ if (!websocket_) {
+ LOG(ERROR) << "Invalid websocket, nullptr";
return PP_ERROR_NOTSUPPORTED;
+ }
websocket_->Connect(web_url, web_protocols);
ppapi::host::HostMessageContext* context,
int32_t code,
const std::string& reason) {
- if (!websocket_)
+ if (!websocket_) {
+ LOG(ERROR) << "Invalid websocket, nullptr";
return PP_ERROR_FAILED;
+ }
close_reply_ = context->MakeReplyMessageContext();
initiating_close_ = true;
scoped_refptr<TrackedCallback> create_callback) {
// Validate the config and keep a reference to it.
EnterResourceNoLock<PPB_AudioConfig_API> enter(config, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter AudioConfig failed";
return PP_ERROR_FAILED;
+ }
config_ = config;
PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>(
PepperPluginInstance::Get(pp_instance()));
- if (!instance)
+ if (!instance) {
+ LOG(ERROR) << "Instance is NULL";
return PP_ERROR_FAILED;
+ }
// When the stream is created, we'll get called back on StreamCreated().
DCHECK(!audio_);
static_cast<int>(enter.object()->GetSampleRate()),
static_cast<int>(enter.object()->GetSampleFrameCount()),
instance->render_frame()->GetWebFrame()->GetLocalFrameToken(), this);
- if (!audio_)
+ if (!audio_) {
+ LOG(ERROR) << "Audio is NULL";
return PP_ERROR_FAILED;
+ }
// At this point, we are guaranteeing ownership of the completion
// callback. Audio promises to fire the completion callback
#include <string>
#include "base/check_op.h"
+#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
int32_t PPB_VideoDecoder_Impl::Decode(
const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
scoped_refptr<TrackedCallback> callback) {
- if (!decoder_)
+ if (!decoder_) {
+ LOG(ERROR) << "Decoder is NULL";
return PP_ERROR_BADRESOURCE;
+ }
EnterResourceNoLock<PPB_Buffer_API> enter(bitstream_buffer->data, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter Buffer failed";
return PP_ERROR_FAILED;
+ }
PPB_Buffer_Impl* buffer = static_cast<PPB_Buffer_Impl*>(enter.object());
DCHECK_GE(bitstream_buffer->id, 0);
media::BitstreamBuffer decode_buffer(bitstream_buffer->id,
buffer->shared_memory().Duplicate(),
bitstream_buffer->size);
- if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback))
+ if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback)) {
+ LOG(ERROR) << "SetBitstreamBufferCallback failed";
return PP_ERROR_BADARGUMENT;
+ }
FlushCommandBuffer();
decoder_->Decode(std::move(decode_buffer));
}
int32_t PPB_VideoDecoder_Impl::Flush(scoped_refptr<TrackedCallback> callback) {
- if (!decoder_)
+ if (!decoder_) {
+ LOG(ERROR) << "Decoder is NULL";
return PP_ERROR_BADRESOURCE;
+ }
- if (!SetFlushCallback(callback))
+ if (!SetFlushCallback(callback)) {
+ LOG(ERROR) << "SetFlushCallback failed";
return PP_ERROR_INPROGRESS;
+ }
FlushCommandBuffer();
decoder_->Flush();
}
int32_t PPB_VideoDecoder_Impl::Reset(scoped_refptr<TrackedCallback> callback) {
- if (!decoder_)
+ if (!decoder_) {
+ LOG(ERROR) << "Decoder is NULL";
return PP_ERROR_BADRESOURCE;
+ }
- if (!SetResetCallback(callback))
+ if (!SetResetCallback(callback)) {
+ LOG(ERROR) << "SetFlushCallback failed";
return PP_ERROR_INPROGRESS;
+ }
FlushCommandBuffer();
decoder_->Reset();
result = PP_OK;
break;
default:
+ LOG(ERROR) << "Decode Error occurred";
result = PP_ERROR_RESOURCE_FAILED;
break;
}
* found in the LICENSE file.
*/
-/* From ppb_file_io.idl modified Tue Oct 22 15:09:47 2013. */
+/* From ppb_file_io.idl modified Wed Mar 15 15:15:36 2017. */
#ifndef PPAPI_C_PPB_FILE_IO_H_
#define PPAPI_C_PPB_FILE_IO_H_
* @param[in] file_io A <code>PP_Resource</code> corresponding to a file
* FileIO.
* @param[in] offset The offset into the file.
- * @param[in] buffer The buffer to hold the specified number of bytes read.
+ * @param[out] buffer The buffer to hold the specified number of bytes read.
* @param[in] bytes_to_read The number of bytes to read from
* <code>offset</code>.
* @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
* @param[in] file_io A <code>PP_Resource</code> corresponding to a file
* FileIO.
* @param[in] offset The offset into the file.
- * @param[in] buffer The buffer to hold the specified number of bytes read.
+ * @param[in] buffer The buffer to hold the specified number of bytes to
+ * write.
* @param[in] bytes_to_write The number of bytes to write to
* <code>offset</code>.
* @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
/// managed by the callback.
///
/// @param[in] offset The offset into the file.
- /// @param[in] buffer The buffer to hold the specified number of bytes read.
+ /// @param[out] buffer The buffer to hold the specified number of bytes read.
/// @param[in] bytes_to_read The number of bytes to read from
/// <code>offset</code>.
/// @param[in] cc A <code>CompletionCallback</code> to be called upon
/// partial write. The FileIO object must have been opened with write access.
///
/// @param[in] offset The offset into the file.
- /// @param[in] buffer The buffer to hold the specified number of bytes read.
+ /// @param[in] buffer The buffer to hold the specified number of bytes to
+ /// write.
/// @param[in] bytes_to_write The number of bytes to write to
/// <code>offset</code>.
/// @param[in] cc A <code>CompletionCallback</code> to be called upon
#include <stdint.h>
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb.h"
#include "ppapi/c/ppp.h"
PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id,
PPB_GetInterface get_browser_interface) {
pp::Module* module = pp::CreateModule();
- if (!module)
+ if (!module) {
+ LOG(ERROR) << "Invalid pp::Module";
return PP_ERROR_FAILED;
+ }
if (!module->InternalInit(module_id, get_browser_interface)) {
delete module;
+ LOG(ERROR) << "Module InternalInit failed";
return PP_ERROR_FAILED;
}
g_module_singleton = module;
} // namespace
-ExtCrxFileSystemPrivate::ExtCrxFileSystemPrivate() {
-}
+ExtCrxFileSystemPrivate::ExtCrxFileSystemPrivate() : instance_(0) {}
ExtCrxFileSystemPrivate::ExtCrxFileSystemPrivate(
const InstanceHandle& instance) : instance_(instance.pp_instance()) {
} // namespace
-UMAPrivate::UMAPrivate() {
-}
+UMAPrivate::UMAPrivate() : instance_(0) {}
UMAPrivate::UMAPrivate(
const InstanceHandle& instance) : instance_(instance.pp_instance()) {
if (has_interface<PPB_Var_1_2>()) {
var_ = get_interface<PPB_Var_1_2>()->VarFromResource(
resource.pp_resource());
+
+ // Set |is_managed_| to true, so |var_| will be properly released upon
+ // destruction.
+ is_managed_ = true;
} else {
PP_NOTREACHED();
- return;
+
+ // Initialize to default values (see Var::Var())
+ memset(&var_, 0, sizeof(var_));
+ var_.type = PP_VARTYPE_UNDEFINED;
+ is_managed_ = true;
}
- // Set |is_managed_| to true, so |var_| will be properly released upon
- // destruction.
- is_managed_ = true;
}
-
Var::Var(const PP_Var& var) {
var_ = var;
is_managed_ = true;
int32_t ResourceMessageHandler::OnResourceMessageReceived(
const IPC::Message& msg,
HostMessageContext* context) {
+ LOG(ERROR) << "The requested command is not supported by the browser";
return PP_ERROR_NOTSUPPORTED;
}
#include <memory>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "ppapi/c/pp_array_output.h"
#include "ppapi/c/pp_codecs.h"
int32_t AudioEncoderResource::GetSupportedProfiles(
const PP_ArrayOutput& output,
const scoped_refptr<TrackedCallback>& callback) {
- if (TrackedCallback::IsPending(get_supported_profiles_callback_))
+ if (TrackedCallback::IsPending(get_supported_profiles_callback_)) {
+ LOG(ERROR) << "Profile not supported";
return PP_ERROR_INPROGRESS;
+ }
get_supported_profiles_callback_ = callback;
Call<PpapiPluginMsg_AudioEncoder_GetSupportedProfilesReply>(
if (device_ref != 0) {
thunk::EnterResourceNoLock<thunk::PPB_DeviceRef_API> enter_device_ref(
device_ref, true);
- if (enter_device_ref.failed())
+ if (enter_device_ref.failed()) {
+ LOG(ERROR) << "Enter DeviceRef failed";
return PP_ERROR_BADRESOURCE;
+ }
device_id = enter_device_ref.object()->GetDeviceRefData().id;
}
- if (TrackedCallback::IsPending(open_callback_))
+ if (TrackedCallback::IsPending(open_callback_)) {
+ LOG(ERROR) << "Open is pending";
return PP_ERROR_INPROGRESS;
- if (open_state_ != BEFORE_OPEN)
+ }
+ if (open_state_ != BEFORE_OPEN) {
+ LOG(ERROR) << "Audio input already opened";
return PP_ERROR_FAILED;
+ }
- if (!audio_input_callback_0_3 && !audio_input_callback)
+ if (!audio_input_callback_0_3 && !audio_input_callback) {
+ LOG(ERROR) << "Cannot resolve audio_input_callback_0_3 or "
+ "audio_input_callback";
return PP_ERROR_BADARGUMENT;
+ }
thunk::EnterResourceNoLock<thunk::PPB_AudioConfig_API> enter_config(config,
true);
- if (enter_config.failed())
+ if (enter_config.failed()) {
+ LOG(ERROR) << "Enter AudioConfig failed";
return PP_ERROR_BADARGUMENT;
+ }
config_ = config;
audio_input_callback_0_3_ = audio_input_callback_0_3;
#include "ppapi/proxy/camera_device_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/proxy/camera_capabilities_resource.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
int32_t CameraDeviceResource::Open(
PP_Var device_id,
const scoped_refptr<TrackedCallback>& callback) {
- if (open_state_ != OpenState::BEFORE_OPEN)
+ if (open_state_ != OpenState::BEFORE_OPEN) {
+ LOG(ERROR) << "Camera device already opened";
return PP_ERROR_FAILED;
+ }
- if (TrackedCallback::IsPending(open_callback_))
+ if (TrackedCallback::IsPending(open_callback_)) {
+ LOG(ERROR) << "Open is pending";
return PP_ERROR_INPROGRESS;
+ }
scoped_refptr<StringVar> source_string_var(StringVar::FromPPVar(device_id));
- if (!source_string_var || source_string_var->value().empty())
+ if (!source_string_var || source_string_var->value().empty()) {
+ LOG(ERROR) << "Couldn't resolve device ID";
return PP_ERROR_BADARGUMENT;
+ }
open_callback_ = callback;
int32_t CameraDeviceResource::GetCameraCapabilities(
PP_Resource* capabilities,
const scoped_refptr<TrackedCallback>& callback) {
- if (!is_opened())
+ if (!is_opened()) {
+ LOG(ERROR) << "Camera is not opened";
return PP_ERROR_FAILED;
+ }
- if (TrackedCallback::IsPending(get_capabilities_callback_))
+ if (TrackedCallback::IsPending(get_capabilities_callback_)) {
+ LOG(ERROR) << "GetCameraCapabilities is pending";
return PP_ERROR_INPROGRESS;
+ }
if (camera_capabilities_.get()) {
*capabilities = camera_capabilities_->GetReference();
int32_t DeviceEnumerationResourceHelper::EnumerateDevices(
const PP_ArrayOutput& output,
scoped_refptr<TrackedCallback> callback) {
- if (pending_enumerate_devices_)
+ if (pending_enumerate_devices_) {
+ LOG(ERROR) << "Enumerate devices pending";
return PP_ERROR_INPROGRESS;
+ }
pending_enumerate_devices_ = true;
PpapiHostMsg_DeviceEnumeration_EnumerateDevices msg;
if (callback) {
monitor_callback_.reset(
ThreadAwareCallback<PP_MonitorDeviceChangeCallback>::Create(callback));
- if (!monitor_callback_.get())
+ if (!monitor_callback_.get()) {
+ LOG(ERROR) << "Cannot get monitor_callback";
return PP_ERROR_NO_MESSAGE_LOOP;
+ }
owner_->Post(PluginResource::RENDERER,
PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange(
const std::vector<DeviceRefData>& devices,
const PP_ArrayOutput& output) {
ArrayWriter writer(output);
- if (!writer.is_valid())
+ if (!writer.is_valid()) {
+ LOG(ERROR) << "Invalid output";
return PP_ERROR_BADARGUMENT;
+ }
std::vector<scoped_refptr<Resource> > device_resources;
for (size_t i = 0; i < devices.size(); ++i) {
device_resources.push_back(new PPB_DeviceRef_Shared(
OBJECT_IS_PROXY, owner_->pp_instance(), devices[i]));
}
- if (!writer.StoreResourceVector(device_resources))
+ if (!writer.StoreResourceVector(device_resources)) {
+ LOG(ERROR) << "Fail in StoreResourceVector";
return PP_ERROR_FAILED;
+ }
return PP_OK;
}
#include <stddef.h>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/strings/string_split.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_errors.h"
PP_Bool save_as,
const PP_Var& suggested_file_name,
scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(callback_))
+ if (TrackedCallback::IsPending(callback_)) {
+ LOG(ERROR) << "ShowInternal is pending";
return PP_ERROR_INPROGRESS;
+ }
if (!sent_create_to_renderer())
SendCreate(RENDERER, PpapiHostMsg_FileChooser_Create());
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/task/task_runner_util.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_errors.h"
int32_t open_flags,
scoped_refptr<TrackedCallback> callback) {
EnterResourceNoLock<PPB_FileRef_API> enter_file_ref(file_ref, true);
- if (enter_file_ref.failed())
+ if (enter_file_ref.failed()) {
+ LOG(ERROR) << "Enter FileRef failed";
return PP_ERROR_BADRESOURCE;
+ }
PPB_FileRef_API* file_ref_api = enter_file_ref.object();
const FileRefCreateInfo& create_info = file_ref_api->GetCreateInfo();
if (!FileSystemTypeIsValid(create_info.file_system_type)) {
+ LOG(ERROR) << "Invalid file system type";
NOTREACHED();
return PP_ERROR_FAILED;
}
if (create_info.file_system_plugin_resource) {
EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(
create_info.file_system_plugin_resource, true);
- if (enter_file_system.failed())
+ if (enter_file_system.failed()) {
+ LOG(ERROR) << "Enter FileSystem failed";
return PP_ERROR_FAILED;
+ }
// Take a reference on the FileSystem resource. The FileIO host uses the
// FileSystem host for running tasks and checking quota.
file_system_resource_ = enter_file_system.resource();
FileIOStateManager::OPERATION_EXCLUSIVE, true);
if (rv != PP_OK)
return rv;
- if (!info)
+ if (!info) {
+ LOG(ERROR) << "PP_FileInfo output memory block not available";
return PP_ERROR_BADARGUMENT;
- if (!FileHolder::IsValid(file_holder_))
+ }
+ if (!FileHolder::IsValid(file_holder_)) {
+ LOG(ERROR) << "Invalid file holder";
return PP_ERROR_FAILED;
+ }
state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
const char* buffer,
int32_t bytes_to_write,
scoped_refptr<TrackedCallback> callback) {
- if (!buffer)
+ if (!buffer) {
+ LOG(ERROR) << "Buffer with input data empty";
return PP_ERROR_FAILED;
- if (offset < 0 || bytes_to_write < 0)
+ }
+ if (offset < 0 || bytes_to_write < 0) {
+ LOG(ERROR) << "Offset and bytes to writes must be non-negative, "
+ << "offset = " << offset
+ << ", bytes to write = " << bytes_to_write;
return PP_ERROR_FAILED;
- if (!FileHolder::IsValid(file_holder_))
+ }
+ if (!FileHolder::IsValid(file_holder_)) {
+ LOG(ERROR) << "Invalid file holder";
return PP_ERROR_FAILED;
+ }
int32_t rv = state_manager_.CheckOperationState(
FileIOStateManager::OPERATION_WRITE, true);
max_offset = offset + bytes_to_write;
if (max_offset >
static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
+ LOG(ERROR) << "Too big predicted offset = " << max_offset;
return PP_ERROR_FAILED; // amount calculation would overflow.
}
increase = static_cast<int64_t>(max_offset) - max_written_offset_;
FileIOStateManager::OPERATION_EXCLUSIVE, true);
if (rv != PP_OK)
return rv;
- if (length < 0)
+ if (length < 0) {
+ LOG(ERROR) << "Length must be non-negative: length=" << length;
return PP_ERROR_FAILED;
+ }
if (check_quota_) {
int64_t increase = length - max_written_offset_;
int32_t bytes_to_read,
const PP_ArrayOutput& array_output,
scoped_refptr<TrackedCallback> callback) {
- if (bytes_to_read < 0)
+ if (bytes_to_read < 0) {
+ LOG(ERROR) << "Bytes to read must be non-negative: bytes to read="
+ << bytes_to_read;
return PP_ERROR_FAILED;
- if (!FileHolder::IsValid(file_holder_))
+ }
+ if (!FileHolder::IsValid(file_holder_)) {
+ LOG(ERROR) << "Invalid file holder";
return PP_ERROR_FAILED;
+ }
state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ);
#include <stddef.h>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "ppapi/c/pp_directory_entry.h"
#include "ppapi/c/pp_instance.h"
int32_t FileRefResource::Query(PP_FileInfo* info,
scoped_refptr<TrackedCallback> callback) {
- if (info == NULL)
+ if (info == NULL) {
+ LOG(ERROR) << "PP_FileInfo output memory block not available";
return PP_ERROR_BADARGUMENT;
+ }
Call<PpapiPluginMsg_FileRef_QueryReply>(
BROWSER, PpapiHostMsg_FileRef_Query(),
#include "base/barrier_closure.h"
#include "base/bind.h"
#include "base/containers/contains.h"
+#include "base/logging.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/ppapi_messages.h"
int32_t FileSystemResource::Open(int64_t expected_size,
scoped_refptr<TrackedCallback> callback) {
DCHECK(type_ != PP_FILESYSTEMTYPE_ISOLATED);
- if (called_open_)
+ if (called_open_) {
+ LOG(ERROR) << "Open already called";
return PP_ERROR_FAILED;
+ }
called_open_ = true;
Call<PpapiPluginMsg_FileSystem_OpenReply>(
// This call is mutually exclusive with Open() above, so we can reuse the
// called_open state.
DCHECK(type_ == PP_FILESYSTEMTYPE_ISOLATED);
- if (called_open_)
+ if (called_open_) {
+ LOG(ERROR) << "Open already called";
return PP_ERROR_FAILED;
+ }
called_open_ = true;
base::RepeatingClosure ipc_callback = base::BarrierClosure(
#include "ppapi/proxy/graphics_2d_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_rect.h"
int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) {
// If host is not even created, return failure immediately. This can happen
// when failed to initialize (in constructor).
- if (!sent_create_to_renderer())
+ if (!sent_create_to_renderer()) {
+ LOG(ERROR) << "Failed to initialize - host not created";
return PP_ERROR_FAILED;
+ }
- if (TrackedCallback::IsPending(current_flush_callback_))
+ if (TrackedCallback::IsPending(current_flush_callback_)) {
+ LOG(ERROR) << "Flush is pending";
return PP_ERROR_INPROGRESS; // Can't have >1 flush pending.
+ }
current_flush_callback_ = callback;
Call<PpapiPluginMsg_Graphics2D_FlushAck>(
uint16_t port,
const PP_HostResolver_Hint* hint,
scoped_refptr<TrackedCallback> callback) {
- if (!hint)
+ if (!hint) {
+ LOG(ERROR) << "Hint is NULL";
return PP_ERROR_BADARGUMENT;
+ }
PP_HostResolver_Private_Hint private_hint =
ConvertToHostResolverPrivateHint(*hint);
#include "ppapi/proxy/host_resolver_resource_base.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/error_conversion.h"
#include "ppapi/proxy/net_address_resource.h"
const PP_HostResolver_Private_Hint* hint,
scoped_refptr<TrackedCallback> callback) {
allow_get_results_ = false;
- if (!host || !hint)
+ if (!host || !hint) {
+ LOG(ERROR) << "Host or hint is NULL";
return PP_ERROR_BADARGUMENT;
- if (ResolveInProgress())
+ }
+ if (ResolveInProgress()) {
+ LOG(ERROR) << "Resolve is pending";
return PP_ERROR_INPROGRESS;
+ }
resolve_callback_ = callback;
PP_IsolatedFileSystemType_Private type,
PP_Resource* file_system_resource,
scoped_refptr<TrackedCallback> callback) {
- if (!file_system_resource)
+ if (!file_system_resource) {
+ LOG(ERROR) << "File system resource is NULL";
return PP_ERROR_BADARGUMENT;
+ }
Call<PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply>(
BROWSER, PpapiHostMsg_IsolatedFileSystem_BrowserOpen(type),
#include "ppapi/proxy/media_stream_audio_track_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/proxy/audio_buffer_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/media_stream_audio_track_shared.h"
int32_t MediaStreamAudioTrackResource::Configure(
const int32_t attrib_list[],
scoped_refptr<TrackedCallback> callback) {
- if (has_ended())
+ if (has_ended()) {
+ LOG(ERROR) << "Media stream audio track has ended";
return PP_ERROR_FAILED;
+ }
if (TrackedCallback::IsPending(configure_callback_) ||
TrackedCallback::IsPending(get_buffer_callback_)) {
+ LOG(ERROR) << "Configure or Get buffer is pending";
return PP_ERROR_INPROGRESS;
}
// Do not support configure if audio buffers are held by plugin.
- if (!buffers_.empty())
+ if (!buffers_.empty()) {
+ LOG(ERROR) << "Audio buffers are already held by plugin";
return PP_ERROR_INPROGRESS;
+ }
MediaStreamAudioTrackShared::Attributes attributes;
int i = 0;
case PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE:
case PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE:
case PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS:
+ LOG(ERROR) << "Attribute not supported";
return PP_ERROR_NOTSUPPORTED;
default:
+ LOG(ERROR);
return PP_ERROR_BADARGUMENT;
}
}
- if (!MediaStreamAudioTrackShared::VerifyAttributes(attributes))
+ if (!MediaStreamAudioTrackShared::VerifyAttributes(attributes)) {
+ LOG(ERROR) << "Given attributes are invalid";
return PP_ERROR_BADARGUMENT;
+ }
configure_callback_ = callback;
Call<PpapiPluginMsg_MediaStreamAudioTrack_ConfigureReply>(
PP_MediaStreamAudioTrack_Attrib attrib,
int32_t* value) {
// TODO(penghuang): Implement this function.
+ LOG(ERROR) << "Function not implemented";
return PP_ERROR_NOTSUPPORTED;
}
int32_t MediaStreamAudioTrackResource::GetBuffer(
PP_Resource* buffer,
scoped_refptr<TrackedCallback> callback) {
- if (has_ended())
+ if (has_ended()) {
+ LOG(ERROR) << "Media stream audio track has ended";
return PP_ERROR_FAILED;
+ }
if (TrackedCallback::IsPending(configure_callback_) ||
- TrackedCallback::IsPending(get_buffer_callback_))
+ TrackedCallback::IsPending(get_buffer_callback_)) {
+ LOG(ERROR) << "Configure or GetBuffer is pending";
return PP_ERROR_INPROGRESS;
+ }
*buffer = GetAudioBuffer();
if (*buffer)
int32_t MediaStreamAudioTrackResource::RecycleBuffer(PP_Resource buffer) {
BufferMap::iterator it = buffers_.find(buffer);
- if (it == buffers_.end())
+ if (it == buffers_.end()) {
+ LOG(ERROR) << "Media stream audio track has ended";
return PP_ERROR_BADRESOURCE;
+ }
scoped_refptr<AudioBufferResource> buffer_resource = it->second;
buffers_.erase(it);
int32_t MediaStreamVideoTrackResource::Configure(
const int32_t attrib_list[],
scoped_refptr<TrackedCallback> callback) {
- if (has_ended())
+ if (has_ended()) {
+ LOG(ERROR) << "Media stream video track has ended";
return PP_ERROR_FAILED;
+ }
if (TrackedCallback::IsPending(configure_callback_) ||
TrackedCallback::IsPending(get_frame_callback_)) {
+ LOG(ERROR) << "Configure or Get frame is pending";
return PP_ERROR_INPROGRESS;
}
// Do not support configure, if frames are hold by plugin.
- if (!frames_.empty())
+ if (!frames_.empty()) {
+ LOG(ERROR) << "Frames are already held by plugin";
return PP_ERROR_INPROGRESS;
+ }
MediaStreamVideoTrackShared::Attributes attributes;
int i = 0;
attributes.format = static_cast<PP_VideoFrame_Format>(attrib_list[i + 1]);
break;
default:
+ LOG(ERROR);
return PP_ERROR_BADARGUMENT;
}
}
- if (!MediaStreamVideoTrackShared::VerifyAttributes(attributes))
+ if (!MediaStreamVideoTrackShared::VerifyAttributes(attributes)) {
+ LOG(ERROR) << "Invalid attributes";
return PP_ERROR_BADARGUMENT;
+ }
configure_callback_ = callback;
Call<PpapiPluginMsg_MediaStreamVideoTrack_ConfigureReply>(
PP_MediaStreamVideoTrack_Attrib attrib,
int32_t* value) {
// TODO(penghuang): implement this function.
+ LOG(ERROR) << "Not implemented function";
return PP_ERROR_NOTSUPPORTED;
}
int32_t MediaStreamVideoTrackResource::GetFrame(
PP_Resource* frame,
scoped_refptr<TrackedCallback> callback) {
- if (has_ended())
+ if (has_ended()) {
+ LOG(ERROR) << "Media stream video track has ended";
return PP_ERROR_FAILED;
+ }
if (TrackedCallback::IsPending(configure_callback_) ||
TrackedCallback::IsPending(get_frame_callback_)) {
+ LOG(ERROR) << "Configure or Get frame is pending";
return PP_ERROR_INPROGRESS;
}
int32_t MediaStreamVideoTrackResource::RecycleFrame(PP_Resource frame) {
FrameMap::iterator it = frames_.find(frame);
- if (it == frames_.end())
+ if (it == frames_.end()) {
+ LOG(ERROR);
return PP_ERROR_BADRESOURCE;
+ }
scoped_refptr<VideoFrameResource> frame_resource = it->second;
frames_.erase(it);
#include <algorithm>
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/shared_impl/array_writer.h"
#include "ppapi/shared_impl/var.h"
int32_t NetworkListResource::GetIpAddresses(uint32_t index,
const PP_ArrayOutput& output) {
ArrayWriter writer(output);
- if (index >= list_.size() || !writer.is_valid())
+ if (index >= list_.size() || !writer.is_valid()) {
+ LOG(ERROR) << "Index is larger than list size or output array is invalid, "
+ << "index = " << index << ", list size = " << list_.size();
return PP_ERROR_BADARGUMENT;
+ }
thunk::EnterResourceCreationNoLock enter(pp_instance());
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter pp_instance failed";
return PP_ERROR_FAILED;
+ }
const std::vector<PP_NetAddress_Private>& addresses =
list_.at(index).addresses;
enter.functions()->CreateNetAddressFromNetAddressPrivate(
pp_instance(), addresses[i]));
}
- if (!writer.StoreResourceVector(addr_resources))
+ if (!writer.StoreResourceVector(addr_resources)) {
+ LOG(ERROR) << "Writer cannot store given resource vector";
return PP_ERROR_FAILED;
+ }
return PP_OK;
}
#include "ppapi/proxy/network_monitor_resource.h"
+#include "base/logging.h"
#include "ppapi/proxy/dispatch_reply_message.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/thunk/enter.h"
int32_t NetworkMonitorResource::UpdateNetworkList(
PP_Resource* network_list,
scoped_refptr<TrackedCallback> callback) {
- if (!network_list)
+ if (!network_list) {
+ LOG(ERROR) << "Network list is NULL";
return PP_ERROR_BADARGUMENT;
- if (TrackedCallback::IsPending(update_callback_))
+ }
+ if (TrackedCallback::IsPending(update_callback_)) {
+ LOG(ERROR) << "Update Network List is pending";
return PP_ERROR_INPROGRESS;
- if (forbidden_)
+ }
+ if (forbidden_) {
+ LOG(ERROR) << "Insufficient permissions";
return PP_ERROR_NOACCESS;
+ }
if (current_list_.get()) {
*network_list = current_list_.Release();
#include "ppapi/proxy/network_proxy_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/proxy/dispatch_reply_message.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/tracked_callback.h"
PP_Var* proxy_string,
scoped_refptr<TrackedCallback> callback) {
StringVar* string_url = StringVar::FromPPVar(url);
- if (!string_url)
+ if (!string_url) {
+ LOG(ERROR) << "Invalid URL";
return PP_ERROR_BADARGUMENT;
+ }
Call<PpapiPluginMsg_NetworkProxy_GetProxyForURLReply>(
BROWSER, PpapiHostMsg_NetworkProxy_GetProxyForURL(string_url->value()),
base::BindOnce(&NetworkProxyResource::OnPluginMsgGetProxyForURLReply,
#include <limits>
+#include "base/logging.h"
#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_globals.h"
params, msg, reply_params, reply));
if (success)
return reply_params->result();
+ LOG(ERROR);
return PP_ERROR_FAILED;
}
}
int32_t Buffer::GetSharedMemory(base::UnsafeSharedMemoryRegion** out_handle) {
+ LOG(ERROR) << "Cannot get shared memory";
NOTREACHED();
return PP_ERROR_NOTSUPPORTED;
}
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include <memory>
-
+#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "build/build_config.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
PP_Resource share_context,
const int32_t* attrib_list) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
- if (!dispatcher)
+ if (!dispatcher) {
+ LOG(ERROR) << "Dispatcher is NULL";
return PP_ERROR_BADARGUMENT;
+ }
HostResource share_host;
gpu::gles2::GLES2Implementation* share_gles2 = nullptr;
if (share_context != 0) {
EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter Graphics3D failed";
return PP_ERROR_BADARGUMENT;
+ }
PPB_Graphics3D_Shared* share_graphics =
static_cast<PPB_Graphics3D_Shared*>(enter.object());
base::UnsafeSharedMemoryRegion** /* region */) {
// Not supported in the proxy (this method is for actually implementing the
// proxy in the host).
+ LOG(ERROR) << "Not supported";
return PP_ERROR_NOACCESS;
}
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/numerics/safe_conversions.h"
#include "build/build_config.h"
PP_Resource message_loop) {
InstanceData* data =
static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
- if (!data)
+ if (!data) {
+ LOG(ERROR) << "Data is NULL";
return PP_ERROR_BADARGUMENT;
+ }
int32_t result = PP_ERROR_FAILED;
std::unique_ptr<MessageHandler> message_handler = MessageHandler::Create(
// Save the mouse callback on the instance data.
InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
GetInstanceData(instance);
- if (!data)
+ if (!data) {
+ LOG(ERROR) << "Data is NULL";
return PP_ERROR_BADARGUMENT;
- if (TrackedCallback::IsPending(data->mouse_lock_callback))
+ }
+ if (TrackedCallback::IsPending(data->mouse_lock_callback)) {
+ LOG(ERROR) << "Lock mouse is pending";
return PP_ERROR_INPROGRESS; // Already have a pending callback.
+ }
data->mouse_lock_callback = callback;
dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse(
}
int32_t MessageLoopResource::AttachToCurrentThread() {
- if (is_main_thread_loop_)
+ if (is_main_thread_loop_) {
+ LOG(ERROR) << "Cannot attach to current thread if it is main thread loop";
return PP_ERROR_INPROGRESS;
+ }
PluginGlobals* globals = PluginGlobals::Get();
slot = new base::ThreadLocalStorage::Slot(&ReleaseMessageLoop);
globals->set_msg_loop_slot(slot);
} else {
- if (slot->Get())
+ if (slot->Get()) {
+ LOG(ERROR) << "Message loop slot already in use";
return PP_ERROR_INPROGRESS;
+ }
}
// TODO(dmichael) check that the current thread can support a task executor.
}
int32_t MessageLoopResource::Run() {
- if (!IsCurrent())
+ if (!IsCurrent()) {
+ LOG(ERROR) << "Run called not on current thread";
return PP_ERROR_WRONG_THREAD;
- if (is_main_thread_loop_)
+ }
+ if (is_main_thread_loop_) {
+ LOG(ERROR) << "Run called on the main thread";
return PP_ERROR_INPROGRESS;
+ }
base::RunLoop* previous_run_loop = run_loop_;
base::RunLoop run_loop;
int32_t MessageLoopResource::PostWork(PP_CompletionCallback callback,
int64_t delay_ms) {
- if (!callback.func)
+ if (!callback.func) {
+ LOG(ERROR);
return PP_ERROR_BADARGUMENT;
- if (destroyed_)
+ }
+ if (destroyed_) {
+ LOG(ERROR) << "Message loop already destroyed";
return PP_ERROR_FAILED;
+ }
PostClosure(FROM_HERE,
base::BindOnce(callback.func, callback.user_data,
static_cast<int32_t>(PP_OK)),
}
int32_t MessageLoopResource::PostQuit(PP_Bool should_destroy) {
- if (is_main_thread_loop_)
+ if (is_main_thread_loop_) {
+ LOG(ERROR) << "Post Quit in main thread loop";
return PP_ERROR_WRONG_THREAD;
+ }
if (PP_ToBool(should_destroy))
should_destroy_ = true;
EnterMessageLoop enter(message_loop, true);
if (enter.succeeded())
return enter.object()->AttachToCurrentThread();
+ LOG(ERROR);
return PP_ERROR_BADRESOURCE;
}
EnterMessageLoop enter(message_loop, true);
if (enter.succeeded())
return enter.object()->Run();
+ LOG(ERROR) << "Cannot enter message loop";
return PP_ERROR_BADRESOURCE;
}
EnterMessageLoop enter(message_loop, true);
if (enter.succeeded())
return enter.object()->PostWork(callback, delay_ms);
+ LOG(ERROR) << "Cannot enter message loop";
return PP_ERROR_BADRESOURCE;
}
EnterMessageLoop enter(message_loop, true);
if (enter.succeeded())
return enter.object()->PostQuit(should_destroy);
+ LOG(ERROR) << "Cannot enter message loop";
return PP_ERROR_BADRESOURCE;
}
scoped_refptr<TrackedCallback> callback) {
EnterResourceNoLock<PPB_Buffer_API>
enter_buffer(bitstream_buffer->data, true);
- if (enter_buffer.failed())
+ if (enter_buffer.failed()) {
+ LOG(ERROR) << "Enter buffer failed";
return PP_ERROR_BADRESOURCE;
+ }
- if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback))
+ if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback)) {
+ LOG(ERROR) << "Cannot set bit stream buffer";
return PP_ERROR_BADARGUMENT;
+ }
Buffer* ppb_buffer =
static_cast<Buffer*>(enter_buffer.object());
}
int32_t VideoDecoder::Flush(scoped_refptr<TrackedCallback> callback) {
- if (!SetFlushCallback(callback))
+ if (!SetFlushCallback(callback)) {
+ LOG(ERROR) << "Cannot set flush callback";
return PP_ERROR_INPROGRESS;
+ }
FlushCommandBuffer();
GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Flush(
}
int32_t VideoDecoder::Reset(scoped_refptr<TrackedCallback> callback) {
- if (!SetResetCallback(callback))
+ if (!SetResetCallback(callback)) {
+ LOG(ERROR) << "Cannot set reset callback";
return PP_ERROR_INPROGRESS;
+ }
FlushCommandBuffer();
GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Reset(
#include "ppapi/proxy/printing_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/dispatch_reply_message.h"
int32_t PrintingResource::GetDefaultPrintSettings(
PP_PrintSettings_Dev* print_settings,
scoped_refptr<TrackedCallback> callback) {
- if (!print_settings)
+ if (!print_settings) {
+ LOG(ERROR) << "Memory for print settings not allocated";
return PP_ERROR_BADARGUMENT;
+ }
if (!sent_create_to_browser())
SendCreate(BROWSER, PpapiHostMsg_Printing_Create());
}
// BasicRawVarData -------------------------------------------------------------
-BasicRawVarData::BasicRawVarData() {
-}
+BasicRawVarData::BasicRawVarData() : var_(PP_MakeUndefined()) {}
BasicRawVarData::~BasicRawVarData() {
}
return;
}
DictionaryVar* dictionary_var = DictionaryVar::FromPPVar(var);
+ DCHECK(dictionary_var);
DCHECK(dictionary_var->key_value_map().empty());
for (size_t i = 0; i < children_.size(); ++i) {
bool success = dictionary_var->SetWithStringKey(children_[i].first,
// Header contains the fields that we send in IPC messages, apart from the
// actual handle. See comments on the SerializedHandle fields below.
struct Header {
- Header() : type(INVALID), size(0), open_flags(0) {}
+ Header() : type(INVALID), size(0), open_flags(0), file_io(0) {}
Header(Type type_arg,
int32_t open_flags_arg,
PP_Resource file_io_arg)
: serialization_rules_(serialization_rules),
var_(PP_MakeUndefined()),
instance_(0),
- cleanup_mode_(CLEANUP_NONE) {
+ cleanup_mode_(CLEANUP_NONE),
+ is_valid_var_(true) {
#ifndef NDEBUG
has_been_serialized_ = false;
has_been_deserialized_ = false;
#include "ppapi/proxy/tcp_server_socket_private_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/tcp_socket_private_resource.h"
const PP_NetAddress_Private* addr,
int32_t backlog,
scoped_refptr<TrackedCallback> callback) {
- if (!addr)
+ if (!addr) {
+ LOG(ERROR) << "Address is NULL";
return PP_ERROR_BADARGUMENT;
- if (state_ != STATE_BEFORE_LISTENING)
+ }
+ if (state_ != STATE_BEFORE_LISTENING) {
+ LOG(ERROR) << "Listening was already started";
return PP_ERROR_FAILED;
- if (TrackedCallback::IsPending(listen_callback_))
+ }
+ if (TrackedCallback::IsPending(listen_callback_)) {
+ LOG(ERROR) << "Listen is pending";
return PP_ERROR_INPROGRESS;
+ }
listen_callback_ = callback;
int32_t TCPServerSocketPrivateResource::Accept(
PP_Resource* tcp_socket,
scoped_refptr<TrackedCallback> callback) {
- if (!tcp_socket)
+ if (!tcp_socket) {
+ LOG(ERROR) << "TCP socket is NULL";
return PP_ERROR_BADARGUMENT;
- if (state_ != STATE_LISTENING)
+ }
+ if (state_ != STATE_LISTENING) {
+ LOG(ERROR) << "Socket not opened or already closed";
return PP_ERROR_FAILED;
- if (TrackedCallback::IsPending(accept_callback_))
+ }
+ if (TrackedCallback::IsPending(accept_callback_)) {
+ LOG(ERROR) << "Accept is pending";
return PP_ERROR_INPROGRESS;
+ }
accept_callback_ = callback;
int32_t TCPServerSocketPrivateResource::GetLocalAddress(
PP_NetAddress_Private* addr) {
- if (!addr)
+ if (!addr) {
+ LOG(ERROR) << "Address is NULL";
return PP_ERROR_BADARGUMENT;
- if (state_ != STATE_LISTENING)
+ }
+ if (state_ != STATE_LISTENING) {
+ LOG(ERROR) << "Socket not opened or already closed";
return PP_ERROR_FAILED;
+ }
*addr = local_addr_;
return PP_OK;
}
#include "ppapi/proxy/tcp_socket_private_resource.h"
+#include "base/logging.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppb_tcp_socket_shared.h"
scoped_refptr<TrackedCallback> callback) {
switch (name) {
case PP_TCPSOCKETOPTION_PRIVATE_INVALID:
+ LOG(ERROR) << "Invalid TCP socket private option";
return PP_ERROR_BADARGUMENT;
case PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY:
return SetOptionImpl(PP_TCPSOCKET_OPTION_NO_DELAY, value,
true, // Check connect() state.
callback);
default:
+ LOG(ERROR);
NOTREACHED();
return PP_ERROR_BADARGUMENT;
}
int32_t TCPSocketResource::Bind(PP_Resource addr,
scoped_refptr<TrackedCallback> callback) {
EnterNetAddressNoLock enter(addr, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter address failed";
return PP_ERROR_BADARGUMENT;
+ }
return BindImpl(&enter.object()->GetNetAddressPrivate(), callback);
}
int32_t TCPSocketResource::Connect(PP_Resource addr,
scoped_refptr<TrackedCallback> callback) {
EnterNetAddressNoLock enter(addr, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter address failed";
return PP_ERROR_BADARGUMENT;
+ }
return ConnectWithNetAddressImpl(&enter.object()->GetNetAddressPrivate(),
callback);
int32_t TCPSocketResourceBase::BindImpl(
const PP_NetAddress_Private* addr,
scoped_refptr<TrackedCallback> callback) {
- if (!addr)
+ if (!addr) {
+ LOG(ERROR) << "Address is NULL";
return PP_ERROR_BADARGUMENT;
- if (state_.IsPending(TCPSocketState::BIND))
+ }
+ if (state_.IsPending(TCPSocketState::BIND)) {
+ LOG(ERROR) << "Bind is pending";
return PP_ERROR_INPROGRESS;
- if (!state_.IsValidTransition(TCPSocketState::BIND))
+ }
+ if (!state_.IsValidTransition(TCPSocketState::BIND)) {
+ LOG(ERROR) << "Invalid Transition";
return PP_ERROR_FAILED;
+ }
bind_callback_ = callback;
state_.SetPendingTransition(TCPSocketState::BIND);
const char* host,
uint16_t port,
scoped_refptr<TrackedCallback> callback) {
- if (!host)
+ if (!host) {
+ LOG(ERROR) << "Host is NULL";
return PP_ERROR_BADARGUMENT;
- if (state_.IsPending(TCPSocketState::CONNECT))
+ }
+ if (state_.IsPending(TCPSocketState::CONNECT)) {
+ LOG(ERROR) << "Connect is pending";
return PP_ERROR_INPROGRESS;
- if (!state_.IsValidTransition(TCPSocketState::CONNECT))
+ }
+ if (!state_.IsValidTransition(TCPSocketState::CONNECT)) {
+ LOG(ERROR) << "Invalid Transition";
return PP_ERROR_FAILED;
+ }
connect_callback_ = callback;
state_.SetPendingTransition(TCPSocketState::CONNECT);
int32_t TCPSocketResourceBase::ConnectWithNetAddressImpl(
const PP_NetAddress_Private* addr,
scoped_refptr<TrackedCallback> callback) {
- if (!addr)
+ if (!addr) {
+ LOG(ERROR) << "Address is NULL";
return PP_ERROR_BADARGUMENT;
- if (state_.IsPending(TCPSocketState::CONNECT))
+ }
+ if (state_.IsPending(TCPSocketState::CONNECT)) {
+ LOG(ERROR) << "ConnectWithNetAddress is pending";
return PP_ERROR_INPROGRESS;
- if (!state_.IsValidTransition(TCPSocketState::CONNECT))
+ }
+ if (!state_.IsValidTransition(TCPSocketState::CONNECT)) {
+ LOG(ERROR) << "Invalid Transition";
return PP_ERROR_FAILED;
+ }
connect_callback_ = callback;
state_.SetPendingTransition(TCPSocketState::CONNECT);
const char* server_name,
uint16_t server_port,
scoped_refptr<TrackedCallback> callback) {
- if (!server_name)
+ if (!server_name) {
+ LOG(ERROR) << "Server name is NULL";
return PP_ERROR_BADARGUMENT;
+ }
if (state_.IsPending(TCPSocketState::SSL_CONNECT) ||
TrackedCallback::IsPending(read_callback_) ||
TrackedCallback::IsPending(write_callback_)) {
+ LOG(ERROR) << "SSL Handshake is pending";
return PP_ERROR_INPROGRESS;
}
- if (!state_.IsValidTransition(TCPSocketState::SSL_CONNECT))
+ if (!state_.IsValidTransition(TCPSocketState::SSL_CONNECT)) {
+ LOG(ERROR) << "Invalid Transition";
return PP_ERROR_FAILED;
+ }
ssl_handshake_callback_ = callback;
state_.SetPendingTransition(TCPSocketState::SSL_CONNECT);
char* buffer,
int32_t bytes_to_read,
scoped_refptr<TrackedCallback> callback) {
- if (!buffer || bytes_to_read <= 0)
+ if (!buffer) {
+ LOG(ERROR) << "Invalid buffer";
+ return PP_ERROR_BADARGUMENT;
+ } else if (bytes_to_read <= 0) {
+ LOG(ERROR) << "Bytes to read must be positive, bytes_to_read="
+ << bytes_to_read;
return PP_ERROR_BADARGUMENT;
+ }
- if (!state_.IsConnected())
+ if (!state_.IsConnected()) {
+ LOG(ERROR) << "Socket is not connected";
return PP_ERROR_FAILED;
+ }
if (TrackedCallback::IsPending(read_callback_) ||
- state_.IsPending(TCPSocketState::SSL_CONNECT))
+ state_.IsPending(TCPSocketState::SSL_CONNECT)) {
+ LOG(ERROR) << "Read is pending";
return PP_ERROR_INPROGRESS;
+ }
read_buffer_ = buffer;
bytes_to_read_ =
std::min(bytes_to_read,
const char* buffer,
int32_t bytes_to_write,
scoped_refptr<TrackedCallback> callback) {
- if (!buffer || bytes_to_write <= 0)
+ if (!buffer) {
+ LOG(ERROR) << "Invalid buffer";
+ return PP_ERROR_BADARGUMENT;
+ } else if (bytes_to_write <= 0) {
+ LOG(ERROR) << "Bytes to write must be positive, bytes_to_write="
+ << bytes_to_write;
return PP_ERROR_BADARGUMENT;
+ }
- if (!state_.IsConnected())
+ if (!state_.IsConnected()) {
+ LOG(ERROR) << "Socket is not connected";
return PP_ERROR_FAILED;
+ }
if (TrackedCallback::IsPending(write_callback_) ||
- state_.IsPending(TCPSocketState::SSL_CONNECT))
+ state_.IsPending(TCPSocketState::SSL_CONNECT)) {
+ LOG(ERROR) << "Write is pending";
return PP_ERROR_INPROGRESS;
+ }
if (bytes_to_write > TCPSocketResourceConstants::kMaxWriteSize)
bytes_to_write = TCPSocketResourceConstants::kMaxWriteSize;
int32_t TCPSocketResourceBase::ListenImpl(
int32_t backlog,
scoped_refptr<TrackedCallback> callback) {
- if (backlog <= 0)
+ if (backlog <= 0) {
+ LOG(ERROR) << "Backlog is negative, backlog = " << backlog;
return PP_ERROR_BADARGUMENT;
- if (state_.IsPending(TCPSocketState::LISTEN))
+ }
+ if (state_.IsPending(TCPSocketState::LISTEN)) {
+ LOG(ERROR) << "Listen is pending";
return PP_ERROR_INPROGRESS;
- if (!state_.IsValidTransition(TCPSocketState::LISTEN))
+ }
+ if (!state_.IsValidTransition(TCPSocketState::LISTEN)) {
+ LOG(ERROR) << "Invalid Transition";
return PP_ERROR_FAILED;
+ }
listen_callback_ = callback;
state_.SetPendingTransition(TCPSocketState::LISTEN);
int32_t TCPSocketResourceBase::AcceptImpl(
PP_Resource* accepted_tcp_socket,
scoped_refptr<TrackedCallback> callback) {
- if (!accepted_tcp_socket)
+ if (!accepted_tcp_socket) {
+ LOG(ERROR) << "Accepted TCP Socket is NULL";
return PP_ERROR_BADARGUMENT;
- if (TrackedCallback::IsPending(accept_callback_))
+ }
+ if (TrackedCallback::IsPending(accept_callback_)) {
+ LOG(ERROR) << "Accept is pending";
return PP_ERROR_INPROGRESS;
- if (state_.state() != TCPSocketState::LISTENING)
+ }
+ if (state_.state() != TCPSocketState::LISTENING) {
+ LOG(ERROR) << "State is not equal to TCPSocketState::LISTENING";
return PP_ERROR_FAILED;
+ }
accept_callback_ = callback;
accepted_tcp_socket_ = accepted_tcp_socket;
SocketOptionData option_data;
switch (name) {
case PP_TCPSOCKET_OPTION_NO_DELAY: {
- if (check_connect_state && !state_.IsConnected())
+ if (check_connect_state && !state_.IsConnected()) {
+ LOG(ERROR) << "Socket is not connected";
return PP_ERROR_FAILED;
+ }
- if (value.type != PP_VARTYPE_BOOL)
+ if (value.type != PP_VARTYPE_BOOL) {
+ LOG(ERROR) << "Wrong data type";
return PP_ERROR_BADARGUMENT;
+ }
option_data.SetBool(PP_ToBool(value.value.as_bool));
break;
}
case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE:
case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: {
- if (check_connect_state && !state_.IsConnected())
+ if (check_connect_state && !state_.IsConnected()) {
+ LOG(ERROR) << "Socket is not connected";
return PP_ERROR_FAILED;
+ }
- if (value.type != PP_VARTYPE_INT32)
+ if (value.type != PP_VARTYPE_INT32) {
+ LOG(ERROR) << "Wrong data type = " << value.type;
return PP_ERROR_BADARGUMENT;
+ }
option_data.SetInt32(value.value.as_int);
break;
}
default: {
+ LOG(ERROR);
NOTREACHED();
return PP_ERROR_BADARGUMENT;
}
base::AutoLock acquire(lock_);
auto it = queues_.find(resource);
if (it == queues_.end()) {
+ LOG(ERROR);
NOTREACHED();
return PP_ERROR_FAILED;
}
PP_Resource* addr_out,
const scoped_refptr<TrackedCallback>& callback) {
ProxyLock::AssertAcquired();
- if (!buffer_out || num_bytes <= 0)
+ if (!buffer_out || num_bytes <= 0) {
+ LOG(ERROR) << "Buffer out is NULL or num_bytes <= 0, bytes = " << num_bytes;
return PP_ERROR_BADARGUMENT;
- if (TrackedCallback::IsPending(recvfrom_callback_))
+ }
+ if (TrackedCallback::IsPending(recvfrom_callback_)) {
+ LOG(ERROR) << "RequestData is pending";
return PP_ERROR_INPROGRESS;
+ }
if (recv_buffers_.empty()) {
read_buffer_ = buffer_out;
} else {
RecvBuffer& front = recv_buffers_.front();
- if (static_cast<size_t>(num_bytes) < front.data.size())
+ if (static_cast<size_t>(num_bytes) < front.data.size()) {
+ LOG(ERROR) << "Front data size is to small for that num_bytes, "
+ << "bytes = " << num_bytes
+ << ", font data size = " << front.data.size();
return PP_ERROR_MESSAGE_TOO_BIG;
+ }
std::unique_ptr<std::string> data_to_pass(new std::string);
data_to_pass->swap(front.data);
public_name = PP_UDPSOCKET_OPTION_BROADCAST;
break;
case PP_UDPSOCKETFEATURE_PRIVATE_COUNT:
+ LOG(ERROR);
return PP_ERROR_BADARGUMENT;
default:
+ LOG(ERROR);
NOTREACHED();
return PP_ERROR_BADARGUMENT;
}
#include "ppapi/proxy/uma_private_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_message_params.h"
#include "ppapi/shared_impl/var.h"
int32_t UMAPrivateResource::IsCrashReportingEnabled(
PP_Instance instance,
scoped_refptr<TrackedCallback> callback) {
- if (pending_callback_.get() != NULL)
+ if (pending_callback_.get() != NULL) {
+ LOG(ERROR) << "CrashReporting pending";
return PP_ERROR_INPROGRESS;
+ }
pending_callback_ = callback;
Call<PpapiPluginMsg_UMA_IsCrashReportingEnabledReply>(
RENDERER, PpapiHostMsg_UMA_IsCrashReportingEnabled(),
"PPB_URLLoader.Open: invalid request resource ID. (Hint to C++ wrapper"
" users: use the ResourceRequest constructor that takes an instance or"
" else the request will be null.)");
+ LOG(ERROR) << "Enter URLRequestInfo failed";
return PP_ERROR_BADARGUMENT;
}
return Open(enter_request.object()->GetData(), 0, callback);
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
- if (mode_ != MODE_WAITING_TO_OPEN)
+ if (mode_ != MODE_WAITING_TO_OPEN) {
+ LOG(ERROR) << "URLLoader already opened";
return PP_ERROR_INPROGRESS;
+ }
request_data_ = request_data;
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
- if (mode_ != MODE_OPENING)
+ if (mode_ != MODE_OPENING) {
+ LOG(ERROR) << "URLLoader already opened";
return PP_ERROR_INPROGRESS;
+ }
SetDefersLoading(false); // Allow the redirect to continue.
RegisterCallback(callback);
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
- if (!response_info_.get())
+ if (!response_info_.get()) {
+ LOG(ERROR) << "Cannot get response info";
return PP_ERROR_FAILED;
+ }
- if (bytes_to_read <= 0 || !buffer)
+ if (bytes_to_read <= 0 || !buffer) {
+ LOG(ERROR) << "Buffer is " << buffer
+ << ", bytes to read = " << bytes_to_read;
return PP_ERROR_BADARGUMENT;
+ }
user_buffer_ = static_cast<char*>(buffer);
user_buffer_size_ = bytes_to_read;
int32_t URLLoaderResource::ValidateCallback(
scoped_refptr<TrackedCallback> callback) {
DCHECK(callback.get());
- if (TrackedCallback::IsPending(pending_callback_))
+ if (TrackedCallback::IsPending(pending_callback_)) {
+ LOG(ERROR) << "Validate is pending";
return PP_ERROR_INPROGRESS;
+ }
return PP_OK;
}
#include <stddef.h>
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/c/dev/ppp_video_capture_dev.h"
#include "ppapi/proxy/dispatch_reply_message.h"
#include "ppapi/proxy/plugin_dispatcher.h"
const PP_VideoCaptureDeviceInfo_Dev& requested_info,
uint32_t buffer_count,
scoped_refptr<TrackedCallback> callback) {
- if (open_state_ != BEFORE_OPEN)
+ if (open_state_ != BEFORE_OPEN) {
+ LOG(ERROR) << "Video capture resource was already opened";
return PP_ERROR_FAILED;
+ }
- if (TrackedCallback::IsPending(open_callback_))
+ if (TrackedCallback::IsPending(open_callback_)) {
+ LOG(ERROR) << "Open is pending";
return PP_ERROR_INPROGRESS;
+ }
open_callback_ = callback;
}
int32_t VideoCaptureResource::StartCapture() {
- if (open_state_ != OPENED)
+ if (open_state_ != OPENED) {
+ LOG(ERROR) << "Video capture resource not opened";
return PP_ERROR_FAILED;
+ }
Post(RENDERER, PpapiHostMsg_VideoCapture_StartCapture());
return PP_OK;
}
int32_t VideoCaptureResource::ReuseBuffer(uint32_t buffer) {
- if (buffer >= buffer_in_use_.size() || !buffer_in_use_[buffer])
+ if (buffer >= buffer_in_use_.size() || !buffer_in_use_[buffer]) {
+ LOG(ERROR) << "Wrong buffer ID = " << buffer << ", should be less than"
+ << buffer_in_use_.size()
+ << "or buffer ID is not busy = " << buffer_in_use_[buffer];
return PP_ERROR_BADARGUMENT;
+ }
Post(RENDERER, PpapiHostMsg_VideoCapture_ReuseBuffer(buffer));
return PP_OK;
}
int32_t VideoCaptureResource::StopCapture() {
- if (open_state_ != OPENED)
+ if (open_state_ != OPENED) {
+ LOG(ERROR) << "Video capture resource not opened";
return PP_ERROR_FAILED;
+ }
Post(RENDERER, PpapiHostMsg_VideoCapture_StopCapture());
return PP_OK;
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/common/mailbox.h"
PP_HardwareAcceleration acceleration,
uint32_t min_picture_count,
scoped_refptr<TrackedCallback> callback) {
- if (initialized_)
+ if (initialized_) {
+ LOG(ERROR) << "Already initialized";
return PP_ERROR_FAILED;
- if (profile < 0 || profile > PP_VIDEOPROFILE_MAX)
+ }
+ if (profile < 0 || profile > PP_VIDEOPROFILE_MAX) {
+ LOG(ERROR) << "Wrong profile = " << static_cast<int>(profile);
return PP_ERROR_BADARGUMENT;
- if (min_picture_count > kMaximumPictureCount)
+ }
+ if (min_picture_count > kMaximumPictureCount) {
+ LOG(ERROR) << "min_picture_count = " << min_picture_count
+ << "should be less or equal to " << kMaximumPictureCount;
return PP_ERROR_BADARGUMENT;
- if (initialize_callback_.get())
+ }
+ if (initialize_callback_.get()) {
+ LOG(ERROR) << "Initialize is pending";
return PP_ERROR_INPROGRESS;
- if (!graphics_context)
+ }
+ if (!graphics_context) {
+ LOG(ERROR) << "Graphics context is NULL";
return PP_ERROR_BADRESOURCE;
+ }
min_picture_count_ = min_picture_count;
// share with the plugin. We can't use the plugin's Graphics3D, since we
// create textures on a proxy thread, and would interfere with the plugin.
thunk::EnterResourceCreationNoLock enter_create(pp_instance());
- if (enter_create.failed())
+ if (enter_create.failed()) {
+ LOG(ERROR) << "Enter pp_instance failed";
return PP_ERROR_FAILED;
+ }
int32_t attrib_list[] = {PP_GRAPHICS3DATTRIB_NONE};
graphics3d_ =
ScopedPPResource(ScopedPPResource::PassRef(),
pp_instance(), graphics_context, attrib_list));
EnterResourceNoLock<PPB_Graphics3D_API> enter_graphics(graphics3d_.get(),
false);
- if (enter_graphics.failed())
+ if (enter_graphics.failed()) {
+ LOG(ERROR) << "Enter Graphics3D failed";
return PP_ERROR_BADRESOURCE;
+ }
PPB_Graphics3D_Shared* ppb_graphics3d_shared =
static_cast<PPB_Graphics3D_Shared*>(enter_graphics.object());
scoped_refptr<TrackedCallback> callback) {
if (decoder_last_error_)
return decoder_last_error_;
- if (flush_callback_.get() || reset_callback_.get())
+ if (flush_callback_.get() || reset_callback_.get()) {
+ LOG(ERROR) << "Get flush_callback or reset_callback";
return PP_ERROR_FAILED;
- if (decode_callback_.get())
+ }
+ if (decode_callback_.get()) {
+ LOG(ERROR) << "Decode is pending";
return PP_ERROR_INPROGRESS;
- if (size > kMaximumBitstreamBufferSize)
+ }
+ if (size > kMaximumBitstreamBufferSize) {
+ LOG(ERROR) << "Wrong size = " << size;
return PP_ERROR_NOMEMORY;
+ }
// If we allow the plugin to call Decode again, we must have somewhere to
// copy their buffer.
PpapiHostMsg_VideoDecoder_GetShm(shm_id, size),
&reply,
&reply_params);
- if (result != PP_OK)
+ if (result != PP_OK) {
+ LOG(ERROR) << "Error in GenericSyncCall, result =" << result;
return PP_ERROR_FAILED;
+ }
if (!UnpackMessage<PpapiPluginMsg_VideoDecoder_GetShmReply>(reply,
- &shm_size))
+ &shm_size)) {
+ LOG(ERROR) << "Cannot unpack message";
return PP_ERROR_FAILED;
+ }
base::UnsafeSharedMemoryRegion shm_region;
if (!reply_params.TakeUnsafeSharedMemoryRegionAtIndex(0, &shm_region) ||
- !shm_region.IsValid() || shm_region.GetSize() != shm_size)
+ !shm_region.IsValid() || shm_region.GetSize() != shm_size) {
+ LOG(ERROR) << "Cannot take shared memory handle at index 0";
return PP_ERROR_NOMEMORY;
+ }
std::unique_ptr<ShmBuffer> shm_buffer(
new ShmBuffer(std::move(shm_region), shm_id));
- if (!shm_buffer->addr)
+ if (!shm_buffer->addr) {
+ LOG(ERROR) << "shm_buffer->addr is NULL";
return PP_ERROR_NOMEMORY;
+ }
available_shm_buffers_.push_back(shm_buffer.get());
if (shm_buffers_.size() < kMaximumPendingDecodes)
scoped_refptr<TrackedCallback> callback) {
if (decoder_last_error_)
return decoder_last_error_;
- if (reset_callback_.get())
+ if (reset_callback_.get()) {
+ LOG(ERROR) << "Got reset callback";
return PP_ERROR_FAILED;
- if (get_picture_callback_.get())
+ }
+ if (get_picture_callback_.get()) {
+ LOG(ERROR) << "GetPicture is pending";
return PP_ERROR_INPROGRESS;
+ }
get_picture_ = picture;
int32_t VideoDecoderResource::Flush(scoped_refptr<TrackedCallback> callback) {
if (decoder_last_error_)
return decoder_last_error_;
- if (reset_callback_.get())
+ if (reset_callback_.get()) {
+ LOG(ERROR) << "Got reset callback";
return PP_ERROR_FAILED;
- if (flush_callback_.get())
+ }
+ if (flush_callback_.get()) {
+ LOG(ERROR) << "Flush is pending";
return PP_ERROR_INPROGRESS;
+ }
flush_callback_ = callback;
Call<PpapiPluginMsg_VideoDecoder_FlushReply>(
int32_t VideoDecoderResource::Reset(scoped_refptr<TrackedCallback> callback) {
if (decoder_last_error_)
return decoder_last_error_;
- if (flush_callback_.get())
+ if (flush_callback_.get()) {
+ LOG(ERROR) << "Got flush callback";
return PP_ERROR_FAILED;
- if (reset_callback_.get())
+ }
+ if (reset_callback_.get()) {
+ LOG(ERROR) << "Reset is pending";
return PP_ERROR_INPROGRESS;
+ }
reset_callback_ = callback;
// Cause any pending Decode or GetPicture callbacks to abort after we return,
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/numerics/safe_conversions.h"
#include "ppapi/c/pp_array_output.h"
int32_t VideoEncoderResource::GetSupportedProfiles(
const PP_ArrayOutput& output,
const scoped_refptr<TrackedCallback>& callback) {
- if (TrackedCallback::IsPending(get_supported_profiles_callback_))
+ if (TrackedCallback::IsPending(get_supported_profiles_callback_)) {
+ LOG(ERROR) << "GetSupportedProfiles is pending";
return PP_ERROR_INPROGRESS;
+ }
get_supported_profiles_callback_ = callback;
Call<PpapiPluginMsg_VideoEncoder_GetSupportedProfilesReply>(
int32_t VideoEncoderResource::GetSupportedProfiles0_1(
const PP_ArrayOutput& output,
const scoped_refptr<TrackedCallback>& callback) {
- if (TrackedCallback::IsPending(get_supported_profiles_callback_))
+ if (TrackedCallback::IsPending(get_supported_profiles_callback_)) {
+ LOG(ERROR) << "GetSupportedProfiles0_1 is pending";
return PP_ERROR_INPROGRESS;
+ }
get_supported_profiles_callback_ = callback;
Call<PpapiPluginMsg_VideoEncoder_GetSupportedProfilesReply>(
uint32_t initial_bitrate,
PP_HardwareAcceleration acceleration,
const scoped_refptr<TrackedCallback>& callback) {
- if (initialized_)
+ if (initialized_) {
+ LOG(ERROR) << "Already initialized";
return PP_ERROR_FAILED;
- if (TrackedCallback::IsPending(initialize_callback_))
+ }
+ if (TrackedCallback::IsPending(initialize_callback_)) {
+ LOG(ERROR) << "Initialize is pending";
return PP_ERROR_INPROGRESS;
+ }
initialize_callback_ = callback;
Call<PpapiPluginMsg_VideoEncoder_InitializeReply>(
if (encoder_last_error_)
return encoder_last_error_;
- if (TrackedCallback::IsPending(get_video_frame_callback_))
+ if (TrackedCallback::IsPending(get_video_frame_callback_)) {
+ LOG(ERROR) << "GetVideoFrame is pending";
return PP_ERROR_INPROGRESS;
+ }
get_video_frame_data_ = video_frame;
get_video_frame_callback_ = callback;
return encoder_last_error_;
VideoFrameMap::iterator it = video_frames_.find(video_frame);
- if (it == video_frames_.end())
+ if (it == video_frames_.end()) {
// TODO(llandwerlin): accept MediaStreamVideoTrack's video frames.
+ LOG(ERROR) << "Video frame not found";
return PP_ERROR_BADRESOURCE;
+ }
scoped_refptr<VideoFrameResource> frame_resource = it->second;
const scoped_refptr<TrackedCallback>& callback) {
if (encoder_last_error_)
return encoder_last_error_;
- if (TrackedCallback::IsPending(get_bitstream_buffer_callback_))
+ if (TrackedCallback::IsPending(get_bitstream_buffer_callback_)) {
+ LOG(ERROR) << "GetBitstreamBuffer is pending";
return PP_ERROR_INPROGRESS;
+ }
get_bitstream_buffer_callback_ = callback;
get_bitstream_buffer_data_ = bitstream_buffer;
#include <vector>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/dispatch_reply_message.h"
const PP_Var protocols[],
uint32_t protocol_count,
scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(connect_callback_))
+ if (TrackedCallback::IsPending(connect_callback_)) {
+ LOG(ERROR) << "Connect is pending";
return PP_ERROR_INPROGRESS;
+ }
// Connect() can be called at most once.
- if (state_ != PP_WEBSOCKETREADYSTATE_INVALID)
+ if (state_ != PP_WEBSOCKETREADYSTATE_INVALID) {
+ LOG(ERROR) << "Connect can be called at most once";
return PP_ERROR_INPROGRESS;
+ }
state_ = PP_WEBSOCKETREADYSTATE_CLOSED;
// Get the URL.
url_ = StringVar::FromPPVar(url);
- if (!url_.get())
+ if (!url_.get()) {
+ LOG(ERROR) << "Invalid URL";
return PP_ERROR_BADARGUMENT;
+ }
// Get the protocols.
std::set<std::string> protocol_set;
scoped_refptr<StringVar> protocol(StringVar::FromPPVar(protocols[i]));
// Check invalid and empty entries.
- if (!protocol.get() || !protocol->value().length())
+ if (!protocol.get() || !protocol->value().length()) {
+ LOG(ERROR) << "Invalid protocol";
return PP_ERROR_BADARGUMENT;
+ }
// Check duplicated protocol entries.
- if (protocol_set.find(protocol->value()) != protocol_set.end())
+ if (protocol_set.find(protocol->value()) != protocol_set.end()) {
+ LOG(ERROR) << "Duplicate protocol entry";
return PP_ERROR_BADARGUMENT;
+ }
protocol_set.insert(protocol->value());
protocol_strings.push_back(protocol->value());
int32_t WebSocketResource::Close(uint16_t code,
const PP_Var& reason,
scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(close_callback_))
+ if (TrackedCallback::IsPending(close_callback_)) {
+ LOG(ERROR) << "Close is pending";
return PP_ERROR_INPROGRESS;
- if (state_ == PP_WEBSOCKETREADYSTATE_INVALID)
+ }
+ if (state_ == PP_WEBSOCKETREADYSTATE_INVALID) {
+ LOG(ERROR) << "Close can be called at most once";
return PP_ERROR_FAILED;
+ }
// Validate |code| and |reason|.
scoped_refptr<StringVar> reason_string_var;
if (code != PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED) {
if (code != PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE &&
(code < PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN ||
- code > PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX))
+ code > PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX)) {
// RFC 6455 limits applications to use reserved connection close code in
// section 7.4.2.. The WebSocket API (http://www.w3.org/TR/websockets/)
// defines this out of range error as InvalidAccessError in JavaScript.
+ LOG(ERROR) << "Insufficient permissions";
return PP_ERROR_NOACCESS;
+ }
// |reason| must be ignored if it is PP_VARTYPE_UNDEFINED or |code| is
// PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED.
// Validate |reason|.
reason_string_var = StringVar::FromPPVar(reason);
if (!reason_string_var.get() ||
- reason_string_var->value().size() > kMaxReasonSizeInBytes)
+ reason_string_var->value().size() > kMaxReasonSizeInBytes) {
+ LOG(ERROR) << "Invalid close reason string";
return PP_ERROR_BADARGUMENT;
+ }
reason_string = reason_string_var->value();
}
}
// Check state.
- if (state_ == PP_WEBSOCKETREADYSTATE_CLOSING)
+ if (state_ == PP_WEBSOCKETREADYSTATE_CLOSING) {
+ LOG(ERROR) << "Close is pending";
return PP_ERROR_INPROGRESS;
+ }
if (state_ == PP_WEBSOCKETREADYSTATE_CLOSED)
return PP_OK;
int32_t WebSocketResource::ReceiveMessage(
PP_Var* message,
scoped_refptr<TrackedCallback> callback) {
- if (TrackedCallback::IsPending(receive_callback_))
+ if (TrackedCallback::IsPending(receive_callback_)) {
+ LOG(ERROR) << "ReceiveMessage is pending";
return PP_ERROR_INPROGRESS;
+ }
// Check state.
if (state_ == PP_WEBSOCKETREADYSTATE_INVALID ||
- state_ == PP_WEBSOCKETREADYSTATE_CONNECTING)
+ state_ == PP_WEBSOCKETREADYSTATE_CONNECTING) {
+ LOG(ERROR) << "WebSocket not connected";
return PP_ERROR_BADARGUMENT;
+ }
// Just return received message if any received message is queued.
if (!received_messages_.empty()) {
}
// Check state again. In CLOSED state, no more messages will be received.
- if (state_ == PP_WEBSOCKETREADYSTATE_CLOSED)
+ if (state_ == PP_WEBSOCKETREADYSTATE_CLOSED) {
+ LOG(ERROR) << "WebSocket already closed";
return PP_ERROR_BADARGUMENT;
+ }
// Returns PP_ERROR_FAILED after an error is received and received messages
// is exhausted.
- if (error_was_received_)
+ if (error_was_received_) {
+ LOG(ERROR) << "Received an error";
return PP_ERROR_FAILED;
+ }
// Or retain |message| as buffer to store and install |callback|.
receive_callback_var_ = message;
int32_t WebSocketResource::SendMessage(const PP_Var& message) {
// Check state.
if (state_ == PP_WEBSOCKETREADYSTATE_INVALID ||
- state_ == PP_WEBSOCKETREADYSTATE_CONNECTING)
+ state_ == PP_WEBSOCKETREADYSTATE_CONNECTING) {
+ LOG(ERROR) << "Wrong state";
return PP_ERROR_BADARGUMENT;
+ }
if (state_ == PP_WEBSOCKETREADYSTATE_CLOSING ||
state_ == PP_WEBSOCKETREADYSTATE_CLOSED) {
payload_size += message_array_buffer->ByteLength();
} else {
// TODO(toyoshim): Support Blob.
+ LOG(ERROR) << message.type << " is not supported";
return PP_ERROR_NOTSUPPORTED;
}
buffered_amount_after_close_ =
SaturateAdd(buffered_amount_after_close_, GetFrameSize(payload_size));
+ LOG(ERROR);
return PP_ERROR_FAILED;
}
if (message.type == PP_VARTYPE_STRING) {
// Convert message to std::string, then send it.
scoped_refptr<StringVar> message_string = StringVar::FromPPVar(message);
- if (!message_string.get())
+ if (!message_string.get()) {
+ LOG(ERROR) << "message_string is NULL";
return PP_ERROR_BADARGUMENT;
+ }
Post(RENDERER, PpapiHostMsg_WebSocket_SendText(message_string->value()));
} else if (message.type == PP_VARTYPE_ARRAY_BUFFER) {
// Convert message to std::vector<uint8_t>, then send it.
scoped_refptr<ArrayBufferVar> message_arraybuffer =
ArrayBufferVar::FromPPVar(message);
- if (!message_arraybuffer.get())
+ if (!message_arraybuffer.get()) {
+ LOG(ERROR) << "Cannot get message_arraybuffer";
return PP_ERROR_BADARGUMENT;
+ }
uint8_t* message_data = static_cast<uint8_t*>(message_arraybuffer->Map());
uint32_t message_length = message_arraybuffer->ByteLength();
std::vector<uint8_t> message_vector(message_data,
Post(RENDERER, PpapiHostMsg_WebSocket_SendBinary(message_vector));
} else {
// TODO(toyoshim): Support Blob.
+ LOG(ERROR) << message.type << " is not supported";
return PP_ERROR_NOTSUPPORTED;
}
return PP_OK;
#include "ppapi/shared_impl/file_io_state_manager.h"
#include "base/check_op.h"
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
namespace ppapi {
int32_t FileIOStateManager::CheckOperationState(OperationType new_op,
bool should_be_open) {
if (should_be_open) {
- if (!file_open_)
+ if (!file_open_) {
+ LOG(ERROR) << "File not opened";
return PP_ERROR_FAILED;
+ }
} else {
- if (file_open_)
+ if (file_open_) {
+ LOG(ERROR) << "File already opened";
return PP_ERROR_FAILED;
+ }
}
if (pending_op_ != OPERATION_NONE &&
- (pending_op_ != new_op || pending_op_ == OPERATION_EXCLUSIVE))
+ (pending_op_ != new_op || pending_op_ == OPERATION_EXCLUSIVE)) {
+ LOG(ERROR) << "Operation is in progress";
return PP_ERROR_INPROGRESS;
+ }
return PP_OK;
}
#include <utility>
#include "base/check_op.h"
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/shared_impl/media_stream_buffer.h"
}
int32_t MediaStreamBufferManager::DequeueBuffer() {
- if (buffer_queue_.empty())
+ if (buffer_queue_.empty()) {
+ LOG(ERROR) << "Buffer queue is empty";
return PP_ERROR_FAILED;
+ }
int32_t buffer = buffer_queue_.front();
buffer_queue_.pop_front();
return buffer;
int32_t PPB_Graphics3D_Shared::GetAttribs(int32_t attrib_list[]) {
// TODO(alokp): Implement me.
+ LOG(ERROR) << "Method not implemented";
return PP_ERROR_FAILED;
}
int32_t PPB_Graphics3D_Shared::SetAttribs(const int32_t attrib_list[]) {
// TODO(alokp): Implement me.
+ LOG(ERROR) << "Method not implemented";
return PP_ERROR_FAILED;
}
int32_t PPB_Graphics3D_Shared::GetError() {
// TODO(alokp): Implement me.
+ LOG(ERROR) << "Method not implemented";
return PP_ERROR_FAILED;
}
int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute,
int32_t* value) {
// TODO(alokp): Implement me.
+ LOG(ERROR) << "Method not implemented";
return PP_ERROR_FAILED;
}
#include <string>
+#include "base/logging.h"
#include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event.h"
#include "ppapi/c/pp_errors.h"
bool is_filtering,
uint32_t event_classes) {
// See if any bits are set we don't know about.
- if (event_classes & ~static_cast<uint32_t>(PP_INPUTEVENT_CLASS_MOUSE |
+ uint32_t result =
+ event_classes & ~static_cast<uint32_t>(PP_INPUTEVENT_CLASS_MOUSE |
PP_INPUTEVENT_CLASS_KEYBOARD |
PP_INPUTEVENT_CLASS_WHEEL |
PP_INPUTEVENT_CLASS_TOUCH |
- PP_INPUTEVENT_CLASS_IME))
+ PP_INPUTEVENT_CLASS_IME);
+ if (result) {
+ LOG(ERROR) << "Not supported input event, result = " << result;
return PP_ERROR_NOTSUPPORTED;
+ }
// Everything else is valid.
return PP_OK;
#include <stdint.h>
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
#include "ppapi/shared_impl/tracked_callback.h"
int32_t GetLocalAddress(PP_Resource tcp_server_socket,
PP_NetAddress_Private* addr) {
EnterTCPServer enter(tcp_server_socket, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter tcp server socket failed";
return PP_ERROR_BADRESOURCE;
+ }
return enter.object()->GetLocalAddress(addr);
}
#include <stdint.h>
+#include "base/logging.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
PP_UDPSocketFeature_Private name,
PP_Var value) {
EnterUDP enter(udp_socket, true);
- if (enter.failed())
+ if (enter.failed()) {
+ LOG(ERROR) << "Enter udpsocket failed";
return PP_ERROR_BADRESOURCE;
+ }
return enter.object()->SetSocketFeature(name, value);
}