diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-11-24 17:23:30 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-11-27 10:31:32 -0600 |
commit | 3bf779cd21f42f488c6590d681b61f860e635692 (patch) | |
tree | 2404cfe89f1b99045f5213b63484b51c06558bb9 /ports/cef/xml_reader.rs | |
parent | 431644bfc8208b613bf69a89826376ffb143cb58 (diff) | |
download | servo-3bf779cd21f42f488c6590d681b61f860e635692.tar.gz servo-3bf779cd21f42f488c6590d681b61f860e635692.zip |
ports/cef: Use the CEF translator tool to generate the full set of CEF
bindings.
This replaces hand-implemented CEF bindings with proper Rust wrappers
automatically generated from the C++ headers. This means that, whenever
CEF's C++ headers change, we can easily generate both the appropriate C
API and the appropriate Rust API. It eliminates much of the hand-written
unsafe code within the CEF port, because the CEF translator tool now
knows how to generate Rust smart pointer wrappers for each class that
corrently perform reference counting.
Additionally, this commit adds utility macros (located in `macros.rs`)
that make it easier to correctly expose Rust objects as CEF objects.
They handle the marshaling of objects between Rust and CEF properly.
The net result of this is that you can write mostly-natural-looking Rust
in the CEF port and interact with it with a natural-looking C++ API on
the embedding side.
This setup relies on the branch of CEF located here:
https://github.com/pcwalton/chromium-embedded-framework
To regenerate, follow the instructions in `ports/cef/README.md`. For
convenience, and because I don't anticipate the API to change much, I
have vendored in all of the appropriate interfaces.
Diffstat (limited to 'ports/cef/xml_reader.rs')
-rw-r--r-- | ports/cef/xml_reader.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ports/cef/xml_reader.rs b/ports/cef/xml_reader.rs new file mode 100644 index 00000000000..e80698db8ef --- /dev/null +++ b/ports/cef/xml_reader.rs @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use interfaces::{cef_stream_reader_t, cef_xml_reader_t}; +use types::{cef_string_t, cef_xml_encoding_type_t}; + +cef_stub_static_method_impls! { + fn cef_xml_reader_create(stream: *mut cef_stream_reader_t, + encoding_type: cef_xml_encoding_type_t, + uri: *const cef_string_t) + -> *mut cef_xml_reader_t; +} + |