cef/libcef_dll/ctocpp/post_data_ctocpp.cc
Marshall Greenblatt 122397acfc Introduce the use of Chromium types (issue #1336).
Changes to the CEF public API:
- Add base::Bind, base::Callback, base::Lock, base::WeakPtr, scoped_refptr, scoped_ptr and supporting types.
- Add include/wrapper/cef_closure_task.h helpers for converting a base::Closure to a CefTask.
- Change CefRefPtr to extend scoped_refptr.
-- Change CefBase method signatures to match RefCountedThreadSafeBase.
- Change IMPLEMENT_REFCOUNTING to use base::AtomicRefCount*.
-- Remove the CefAtomic* functions.
-- IMPLEMENT_REFCOUNTING now enforces via a compile-time error that the correct class name was passed to the macro.
- Change IMPLEMENT_LOCKING to use base::Lock.
-- Remove the CefCriticalSection class.
-- Deprecate the IMPLEMENT_LOCKING macro.
-- base::Lock will DCHECK() in Debug builds if lock usage is reentrant.
- Move include/internal/cef_tuple.h to include/base/cef_tuple.h.
- Allow an empty |callback| parameter passed to CefBeginTracing.

Changes to the CEF implementation:
- Fix incorrect names passed to the IMPLEMENT_REFCOUNTING macro.
- Fix instances of reentrant locking in the CefXmlObject and CefRequest implementations.
- Remove use of the IMPLEMENT_LOCKING macro.

Changes to cef_unittests:
- Add tests/unittests/chromium_includes.h and always include it first from unit test .cc files to avoid name conflicts with Chromium types.
- Fix wrong header include ordering.
- Remove use of the IMPLEMENT_LOCKING macro.

Changes to cefclient and cefsimple:
- Use base::Bind and cef_closure_task.h instead of NewCefRunnable*.
- Remove use of the IMPEMENT_LOCKING macro.
- Fix incorrect/unnecessary locking.
- Add additional runtime thread checks.
- Windows: Perform actions on the UI thread instead of the main thread when running in multi-threaded-message-loop mode to avoid excessive locking.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1769 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2014-07-14 22:18:51 +00:00

151 lines
4.1 KiB
C++

// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include <algorithm>
#include "libcef_dll/ctocpp/post_data_ctocpp.h"
#include "libcef_dll/ctocpp/post_data_element_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefPostData> CefPostData::Create() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_post_data_t* _retval = cef_post_data_create();
// Return type: refptr_same
return CefPostDataCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
bool CefPostDataCToCpp::IsReadOnly() {
if (CEF_MEMBER_MISSING(struct_, is_read_only))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_read_only(struct_);
// Return type: bool
return _retval?true:false;
}
size_t CefPostDataCToCpp::GetElementCount() {
if (CEF_MEMBER_MISSING(struct_, get_element_count))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = struct_->get_element_count(struct_);
// Return type: simple
return _retval;
}
void CefPostDataCToCpp::GetElements(ElementVector& elements) {
if (CEF_MEMBER_MISSING(struct_, get_elements))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: elements; type: refptr_vec_same_byref
size_t elementsSize = elements.size();
size_t elementsCount = std::max(GetElementCount(), elementsSize);
cef_post_data_element_t** elementsList = NULL;
if (elementsCount > 0) {
elementsList = new cef_post_data_element_t*[elementsCount];
DCHECK(elementsList);
if (elementsList) {
memset(elementsList, 0, sizeof(cef_post_data_element_t*)*elementsCount);
}
if (elementsList && elementsSize > 0) {
for (size_t i = 0; i < elementsSize; ++i) {
elementsList[i] = CefPostDataElementCToCpp::Unwrap(elements[i]);
}
}
}
// Execute
struct_->get_elements(struct_,
&elementsCount,
elementsList);
// Restore param:elements; type: refptr_vec_same_byref
elements.clear();
if (elementsCount > 0 && elementsList) {
for (size_t i = 0; i < elementsCount; ++i) {
elements.push_back(CefPostDataElementCToCpp::Wrap(elementsList[i]));
}
delete [] elementsList;
}
}
bool CefPostDataCToCpp::RemoveElement(CefRefPtr<CefPostDataElement> element) {
if (CEF_MEMBER_MISSING(struct_, remove_element))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: element; type: refptr_same
DCHECK(element.get());
if (!element.get())
return false;
// Execute
int _retval = struct_->remove_element(struct_,
CefPostDataElementCToCpp::Unwrap(element));
// Return type: bool
return _retval?true:false;
}
bool CefPostDataCToCpp::AddElement(CefRefPtr<CefPostDataElement> element) {
if (CEF_MEMBER_MISSING(struct_, add_element))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: element; type: refptr_same
DCHECK(element.get());
if (!element.get())
return false;
// Execute
int _retval = struct_->add_element(struct_,
CefPostDataElementCToCpp::Unwrap(element));
// Return type: bool
return _retval?true:false;
}
void CefPostDataCToCpp::RemoveElements() {
if (CEF_MEMBER_MISSING(struct_, remove_elements))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
struct_->remove_elements(struct_);
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefPostDataCToCpp, CefPostData,
cef_post_data_t>::DebugObjCt = 0;
#endif