diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 18:45:23 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 18:45:23 +0000 |
commit | 334257b5f1d3ca12e6a2c852a9e6cfd5f2de3f52 (patch) | |
tree | fd69e3a05de51dfeeeb132ebceb32e5622a578a8 /ppapi | |
parent | 33e0b4916f5ceae96cab04a744db5db4b57fc89d (diff) | |
download | chromium_src-334257b5f1d3ca12e6a2c852a9e6cfd5f2de3f52.zip chromium_src-334257b5f1d3ca12e6a2c852a9e6cfd5f2de3f52.tar.gz chromium_src-334257b5f1d3ca12e6a2c852a9e6cfd5f2de3f52.tar.bz2 |
Revert 189855 "Add Pepper TrueType Font resource implementations..."
See failures:
http://build.chromium.org/p/chromium.mac/builders/Mac10.6%20Tests%20%283%29/builds/31751
PPAPINaClPNaClTest.TrueTypeFont:
Right after fork
Right before base::type_profiler::Controller::Stop()
Right after base::type_profiler::Controller::Stop()
Right after signal/exception handler restoration.
Right after fd_shuffle push_backs.
Right after ShuffleFileDescriptors
Right after CloseSuperfluousFds
Right before execvp
/Volumes/data/b/build/third_party/zope/__init__.py:19: UserWarning: Module twisted was already imported from /Volumes/data/b/build/third_party/twisted_10_2/twisted/__init__.pyc, but /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python is being added to sys.path
import pkg_resources
/Volumes/data/b/build/third_party/zope/__init__.py:19: UserWarning: Module zope was already imported from /Volumes/data/b/build/third_party/zope/__init__.pyc, but /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python is being added to sys.path
import pkg_resources
HTTP server started on 127.0.0.1:53717...
sending server_data: {"host": "127.0.0.1", "port": 53717} (36 bytes)
[4855,2953998336:11:38:54.290560] Native Client module will be loaded at base address 0x00000000382f0000
/Volumes/data/b/build/slave/cr-mac-rel/build/src/chrome/test/ppapi/ppapi_test.cc:265: Failure
Value of: handler.message().c_str()
Actual: "GetTable FAIL: Failure in tests/test_truetype_font.cc(303): (0) == (memcmp(&entire_font[kOffset], &partial_font[0], kMaxDataSize))"
Expected: "PASS"
[4851:34307:0322/113854:901117653597:INFO:nacl_process_host.cc(232)] NaCl process exited with status 0 (0x0)
> Add Pepper TrueType Font resource implementations for Win, Mac, and Linux.
> Replaces TrueTypeFont stubs with platform code.
> Adds ppapi tests for the API.
>
> BUG=79375
> TEST=browser_tests, --gtest_filter="OutOfProcessPPAPITest.TrueTypeFont*"
>
> Review URL: https://codereview.chromium.org/12764016
TBR=bbudge@chromium.org
Review URL: https://codereview.chromium.org/12771027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/cpp/dev/truetype_font_dev.h | 32 | ||||
-rw-r--r-- | ppapi/ppapi_sources.gypi | 2 | ||||
-rw-r--r-- | ppapi/tests/test_truetype_font.cc | 363 | ||||
-rw-r--r-- | ppapi/tests/test_truetype_font.h | 36 | ||||
-rw-r--r-- | ppapi/tests/test_utils.h | 5 | ||||
-rw-r--r-- | ppapi/thunk/enter.cc | 4 | ||||
-rw-r--r-- | ppapi/thunk/ppb_truetype_font_thunk.cc | 3 |
7 files changed, 8 insertions, 437 deletions
diff --git a/ppapi/cpp/dev/truetype_font_dev.h b/ppapi/cpp/dev/truetype_font_dev.h index 30c310b..124d3eb 100644 --- a/ppapi/cpp/dev/truetype_font_dev.h +++ b/ppapi/cpp/dev/truetype_font_dev.h @@ -174,43 +174,21 @@ class TrueTypeFont_Dev : public Resource { namespace internal { -// This is used by the CompletionCallbackFactory system to hold the output from -// the async 'Describe' function call. When 'output' is called, this data is -// wrapped and a reference is passed to the plugin's callback function. -class TrueTypeFontAdapterWithStorage { - public: - TrueTypeFontAdapterWithStorage() { - } - - PP_TrueTypeFontDesc_Dev* pp_output() { return &pp_desc_; } - - TrueTypeFontDesc_Dev& output() { - desc_ = TrueTypeFontDesc_Dev(PASS_REF, pp_desc_); - return desc_; - } - - private: - // |pp_desc_| will be written by the 'Describe' function. |desc_| will be - // constructed and will manage the PP_Var in pp_desc_. - PP_TrueTypeFontDesc_Dev pp_desc_; - TrueTypeFontDesc_Dev desc_; -}; - // A specialization of CallbackOutputTraits to provide the callback system the // information on how to handle pp::TrueTypeFontDesc_Dev. This converts // PP_TrueTypeFontDesc_Dev to pp::TrueTypeFontDesc_Dev when passing to the // plugin, and specifically manages the PP_Var embedded in the desc_ field. template<> -struct CallbackOutputTraits<TrueTypeFontDesc_Dev> { +struct CallbackOutputTraits<pp::TrueTypeFontDesc_Dev> { typedef PP_TrueTypeFontDesc_Dev* APIArgType; - typedef TrueTypeFontAdapterWithStorage StorageType; + typedef PP_TrueTypeFontDesc_Dev StorageType; static inline APIArgType StorageToAPIArg(StorageType& t) { - return t.pp_output(); + return &t; } - static inline TrueTypeFontDesc_Dev& StorageToPluginArg(StorageType& t) { - return t.output(); + static inline pp::TrueTypeFontDesc_Dev StorageToPluginArg(StorageType& t) { + return pp::TrueTypeFontDesc_Dev(PASS_REF, t); } }; diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index 7efc070..1d61391 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -426,8 +426,6 @@ 'tests/test_tcp_server_socket_private.h', 'tests/test_tcp_socket_private.cc', 'tests/test_tcp_socket_private.h', - 'tests/test_truetype_font.cc', - 'tests/test_truetype_font.h', 'tests/test_udp_socket_private.cc', 'tests/test_udp_socket_private.h', 'tests/test_url_loader.cc', diff --git a/ppapi/tests/test_truetype_font.cc b/ppapi/tests/test_truetype_font.cc deleted file mode 100644 index 9c1456d..0000000 --- a/ppapi/tests/test_truetype_font.cc +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Tests PPB_TrueTypeFont interface. - -#include "ppapi/tests/test_truetype_font.h" - -#include <string.h> -#include <algorithm> -#include <limits> - -#include "ppapi/c/dev/ppb_testing_dev.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/truetype_font_dev.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/var.h" -#include "ppapi/tests/test_utils.h" -#include "ppapi/tests/testing_instance.h" - -REGISTER_TEST_CASE(TrueTypeFont); - -#define MAKE_TABLE_TAG(a, b, c, d) ((a) << 24) + ((b) << 16) + ((c) << 8) + (d) - -namespace { - -const PP_Resource kInvalidResource = 0; -const PP_Instance kInvalidInstance = 0; - -// TrueType font header and table entry structs. See -// https://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html -struct FontHeader { - int32_t font_type; - uint16_t num_tables; - uint16_t search_range; - uint16_t entry_selector; - uint16_t range_shift; -}; - -struct FontDirectoryEntry { - uint32_t tag; - uint32_t checksum; - uint32_t offset; - uint32_t logical_length; -}; - -uint32_t ReadBigEndian32(const void* ptr) { - const uint8_t* data = reinterpret_cast<const uint8_t*>(ptr); - return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24); -} - -uint16_t ReadBigEndian16(const void* ptr) { - const uint8_t* data = reinterpret_cast<const uint8_t*>(ptr); - return (data[1] << 0) | (data[0] << 8); -} - -} - -TestTrueTypeFont::TestTrueTypeFont(TestingInstance* instance) - : TestCase(instance), - ppb_truetype_font_interface_(NULL), - ppb_core_interface_(NULL), - ppb_var_interface_(NULL) { -} - -bool TestTrueTypeFont::Init() { - ppb_truetype_font_interface_ = static_cast<const PPB_TrueTypeFont_Dev*>( - pp::Module::Get()->GetBrowserInterface(PPB_TRUETYPEFONT_DEV_INTERFACE)); - ppb_core_interface_ = static_cast<const PPB_Core*>( - pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE)); - ppb_var_interface_ = static_cast<const PPB_Var*>( - pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); - if (!ppb_truetype_font_interface_) - instance_->AppendError("PPB_TrueTypeFont_Dev interface not available"); - if (!ppb_core_interface_) - instance_->AppendError("PPB_Core interface not available"); - if (!ppb_var_interface_) - instance_->AppendError("PPB_Var interface not available"); - - return true; -} - -TestTrueTypeFont::~TestTrueTypeFont() { -} - -void TestTrueTypeFont::RunTests(const std::string& filter) { - RUN_TEST(GetFontFamilies, filter); - RUN_TEST(Create, filter); - RUN_TEST(Describe, filter); - RUN_TEST(GetTableTags, filter); - RUN_TEST(GetTable, filter); -} - -std::string TestTrueTypeFont::TestGetFontFamilies() { - { - // A valid instance should be able to enumerate fonts. - TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(pp::TrueTypeFont_Dev::GetFontFamilies(instance_, cc)); - const std::vector<pp::Var> font_families = cc.output(); - // We should get some font families on any platform. - ASSERT_NE(0, font_families.size()); - ASSERT_EQ(static_cast<int32_t>(font_families.size()), cc.result()); - // Make sure at least one family is a non-empty string. - ASSERT_NE(0, font_families[0].AsString().size()); - } - { - // Using an invalid instance should fail. - TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc( - instance_->pp_instance(), false); - cc.WaitForResult( - ppb_truetype_font_interface_->GetFontFamilies( - kInvalidInstance, - cc.GetCallbackWithOutput().output(), - cc.GetCallback().pp_completion_callback())); - ASSERT_EQ(PP_ERROR_FAILED, cc.result()); - ASSERT_EQ(0, cc.output().size()); - } - - PASS(); -} - -std::string TestTrueTypeFont::TestCreate() { - PP_Resource font; - PP_TrueTypeFontDesc_Dev desc = { - PP_MakeUndefined(), - PP_TRUETYPEFONTFAMILY_SERIF, - PP_TRUETYPEFONTSTYLE_NORMAL, - PP_TRUETYPEFONTWEIGHT_NORMAL, - PP_TRUETYPEFONTWIDTH_NORMAL, - PP_TRUETYPEFONTCHARSET_DEFAULT - }; - // Creating a font from an invalid instance returns an invalid resource. - font = ppb_truetype_font_interface_->Create(kInvalidInstance, &desc); - ASSERT_EQ(kInvalidResource, font); - ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsFont(font)); - - // Creating a font from a valid instance returns a font resource. - font = ppb_truetype_font_interface_->Create(instance_->pp_instance(), &desc); - ASSERT_NE(kInvalidResource, font); - ASSERT_EQ(PP_TRUE, ppb_truetype_font_interface_->IsFont(font)); - - ppb_core_interface_->ReleaseResource(font); - // Once released, the resource shouldn't be a font. - ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsFont(font)); - - PASS(); -} - -std::string TestTrueTypeFont::TestDescribe() { - pp::TrueTypeFontDesc_Dev create_desc; - create_desc.set_generic_family(PP_TRUETYPEFONTFAMILY_SERIF); - create_desc.set_style(PP_TRUETYPEFONTSTYLE_NORMAL); - create_desc.set_weight(PP_TRUETYPEFONTWEIGHT_NORMAL); - pp::TrueTypeFont_Dev font(instance_, create_desc); - // Describe: See what font-matching did with a generic font. We should always - // be able to Create a generic Serif font. - TestCompletionCallbackWithOutput<pp::TrueTypeFontDesc_Dev> cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.Describe(cc)); - pp::TrueTypeFontDesc_Dev& desc = cc.output(); - ASSERT_NE(0, desc.family().AsString().size()); - ASSERT_EQ(PP_TRUETYPEFONTFAMILY_SERIF, desc.generic_family()); - ASSERT_EQ(PP_TRUETYPEFONTSTYLE_NORMAL, desc.style()); - ASSERT_EQ(PP_TRUETYPEFONTWEIGHT_NORMAL, desc.weight()); - - // Describe an invalid resource should fail. - PP_TrueTypeFontDesc_Dev fail_desc; - memset(&fail_desc, 0, sizeof(fail_desc)); - fail_desc.family = PP_MakeUndefined(); - // Create a shallow copy to check that no data is changed. - PP_TrueTypeFontDesc_Dev fail_desc_copy; - memcpy(&fail_desc_copy, &fail_desc, sizeof(fail_desc)); - - cc.WaitForResult( - ppb_truetype_font_interface_->Describe( - kInvalidResource, - &fail_desc, - cc.GetCallback().pp_completion_callback())); - ASSERT_EQ(PP_ERROR_BADRESOURCE, cc.result()); - ASSERT_EQ(PP_VARTYPE_UNDEFINED, fail_desc.family.type); - ASSERT_EQ(0, memcmp(&fail_desc, &fail_desc_copy, sizeof(fail_desc))); - - PASS(); -} - -std::string TestTrueTypeFont::TestGetTableTags() { - pp::TrueTypeFontDesc_Dev desc; - pp::TrueTypeFont_Dev font(instance_, desc); - { - TestCompletionCallbackWithOutput< std::vector<uint32_t> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.GetTableTags(cc)); - std::vector<uint32_t> tags = cc.output(); - ASSERT_NE(0, tags.size()); - ASSERT_EQ(static_cast<int32_t>(tags.size()), cc.result()); - // Tags will vary depending on the actual font that the host platform - // chooses. Check that all required TrueType tags are present. - const int required_tag_count = 9; - uint32_t required_tags[required_tag_count] = { - // Note: these must be sorted for std::includes below. - MAKE_TABLE_TAG('c', 'm', 'a', 'p'), - MAKE_TABLE_TAG('g', 'l', 'y', 'f'), - MAKE_TABLE_TAG('h', 'e', 'a', 'd'), - MAKE_TABLE_TAG('h', 'h', 'e', 'a'), - MAKE_TABLE_TAG('h', 'm', 't', 'x'), - MAKE_TABLE_TAG('l', 'o', 'c', 'a'), - MAKE_TABLE_TAG('m', 'a', 'x', 'p'), - MAKE_TABLE_TAG('n', 'a', 'm', 'e'), - MAKE_TABLE_TAG('p', 'o', 's', 't') - }; - std::sort(tags.begin(), tags.end()); - ASSERT_TRUE(std::includes(tags.begin(), - tags.end(), - required_tags, - required_tags + required_tag_count)); - } - { - // Invalid resource should fail and write no data. - TestCompletionCallbackWithOutput< std::vector<uint32_t> > cc( - instance_->pp_instance(), false); - cc.WaitForResult( - ppb_truetype_font_interface_->GetTableTags( - kInvalidResource, - cc.GetCallbackWithOutput().output(), - cc.GetCallback().pp_completion_callback())); - ASSERT_EQ(PP_ERROR_BADRESOURCE, cc.result()); - ASSERT_EQ(0, cc.output().size()); - } - - PASS(); -} - -std::string TestTrueTypeFont::TestGetTable() { - pp::TrueTypeFontDesc_Dev desc; - pp::TrueTypeFont_Dev font(instance_, desc); - - { - // Getting a required table from a valid font should succeed. - TestCompletionCallbackWithOutput< std::vector<char> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'), - 0, std::numeric_limits<int32_t>::max(), - cc)); - const std::vector<char> data = cc.output(); - ASSERT_NE(0, data.size()); - ASSERT_EQ(static_cast<int32_t>(data.size()), cc.result()); - - // Passing 0 for the table tag should return the entire font. - TestCompletionCallbackWithOutput< std::vector<char> > cc2( - instance_->pp_instance(), false); - cc2.WaitForResult(font.GetTable(0 /* table_tag */, - 0, std::numeric_limits<int32_t>::max(), - cc2)); - const std::vector<char> entire_font = cc2.output(); - ASSERT_NE(0, entire_font.size()); - ASSERT_EQ(static_cast<int32_t>(entire_font.size()), cc2.result()); - - // Verify that the CMAP table is in entire_font, and that it's identical - // to the one we retrieved above. Note that since the font header and table - // directory are in file (big-endian) order, we need to byte swap tags and - // numbers. - const size_t kHeaderSize = sizeof(FontHeader); - const size_t kEntrySize = sizeof(FontDirectoryEntry); - ASSERT_TRUE(kHeaderSize < entire_font.size()); - FontHeader header; - memcpy(&header, &entire_font[0], kHeaderSize); - uint16_t num_tables = ReadBigEndian16(&header.num_tables); - std::vector<FontDirectoryEntry> directory(num_tables); - size_t directory_size = kEntrySize * num_tables; - ASSERT_TRUE(kHeaderSize + directory_size < entire_font.size()); - memcpy(&directory[0], &entire_font[kHeaderSize], directory_size); - const FontDirectoryEntry* cmap_entry = NULL; - for (uint16_t i = 0; i < num_tables; i++) { - if (ReadBigEndian32(&directory[i].tag) == - MAKE_TABLE_TAG('c', 'm', 'a', 'p')) { - cmap_entry = &directory[i]; - break; - } - } - ASSERT_NE(NULL, cmap_entry); - - uint32_t logical_length = ReadBigEndian32(&cmap_entry->logical_length); - uint32_t table_offset = ReadBigEndian32(&cmap_entry->offset); - ASSERT_EQ(static_cast<size_t>(logical_length), data.size()); - ASSERT_TRUE(static_cast<size_t>(table_offset + logical_length) < - entire_font.size()); - const char* cmap_table = &entire_font[0] + table_offset; - ASSERT_EQ(0, memcmp(cmap_table, &data[0], data.size())); - - // Use offset and max_data_length to restrict the data. - TestCompletionCallbackWithOutput< std::vector<char> > cc3( - instance_->pp_instance(), false); - const int32_t kOffset = 4; - const int32_t kMaxDataSize = 1000; - cc3.WaitForResult(font.GetTable(0 /* table_tag */, - kOffset, - kMaxDataSize, - cc3)); - const std::vector<char> partial_font = cc3.output(); - ASSERT_EQ(partial_font.size(), static_cast<size_t>(cc3.result())); - ASSERT_EQ(partial_font.size(), static_cast<size_t>(kMaxDataSize)); - ASSERT_EQ(0, memcmp(&entire_font[kOffset], &partial_font[0], kMaxDataSize)); - } - { - // Getting an invalid table should fail ('zzzz' should be safely invalid). - TestCompletionCallbackWithOutput< std::vector<char> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('z', 'z', 'z', 'z'), - 0, std::numeric_limits<int32_t>::max(), - cc)); - ASSERT_EQ(0, cc.output().size()); - ASSERT_EQ(PP_ERROR_FAILED, cc.result()); - } - { - // GetTable on an invalid resource should fail with a bad resource error - // and write no data. - TestCompletionCallbackWithOutput< std::vector<char> > cc( - instance_->pp_instance(), false); - cc.WaitForResult( - ppb_truetype_font_interface_->GetTable( - kInvalidResource, - MAKE_TABLE_TAG('c', 'm', 'a', 'p'), - 0, std::numeric_limits<int32_t>::max(), - cc.GetCallbackWithOutput().output(), - cc.GetCallback().pp_completion_callback())); - ASSERT_EQ(PP_ERROR_BADRESOURCE, cc.result()); - ASSERT_EQ(0, cc.output().size()); - } - { - // Negative offset should fail with a bad argument error and write no data. - TestCompletionCallbackWithOutput< std::vector<char> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'), - -100, 0, - cc)); - ASSERT_EQ(PP_ERROR_BADARGUMENT, cc.result()); - ASSERT_EQ(0, cc.output().size()); - } - { - // Offset larger than file size succeeds but returns no data. - TestCompletionCallbackWithOutput< std::vector<char> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'), - 1 << 28, 0, - cc)); - ASSERT_EQ(PP_OK, cc.result()); - ASSERT_EQ(0, cc.output().size()); - } - { - // Negative max_data_length should fail with a bad argument error and write - // no data. - TestCompletionCallbackWithOutput< std::vector<char> > cc( - instance_->pp_instance(), false); - cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'), - 0, -100, - cc)); - ASSERT_EQ(PP_ERROR_BADARGUMENT, cc.result()); - ASSERT_EQ(0, cc.output().size()); - } - - PASS(); -} diff --git a/ppapi/tests/test_truetype_font.h b/ppapi/tests/test_truetype_font.h deleted file mode 100644 index 90977c8..0000000 --- a/ppapi/tests/test_truetype_font.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PAPPI_TESTS_TEST_TRUETYPE_FONT_H_ -#define PAPPI_TESTS_TEST_TRUETYPE_FONT_H_ - -#include <string> - -#include "ppapi/c/dev/ppb_truetype_font_dev.h" -#include "ppapi/c/ppb_core.h" -#include "ppapi/c/ppb_var.h" -#include "ppapi/tests/test_case.h" - -class TestTrueTypeFont : public TestCase { - public: - explicit TestTrueTypeFont(TestingInstance* instance); - virtual ~TestTrueTypeFont(); - - private: - // TestCase implementation. - virtual bool Init(); - virtual void RunTests(const std::string& filter); - - std::string TestGetFontFamilies(); - std::string TestCreate(); - std::string TestDescribe(); - std::string TestGetTableTags(); - std::string TestGetTable(); - - const PPB_TrueTypeFont_Dev* ppb_truetype_font_interface_; - const PPB_Core* ppb_core_interface_; - const PPB_Var* ppb_var_interface_; -}; - -#endif // PAPPI_TESTS_TEST_TRUETYPE_FONT_H_ diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h index 3a471d8..e61efbd 100644 --- a/ppapi/tests/test_utils.h +++ b/ppapi/tests/test_utils.h @@ -190,10 +190,7 @@ class TestCompletionCallbackWithOutput : public TestCompletionCallback { return GetCallbackWithOutput(); } - OutputT& output() { - return pp::internal::CallbackOutputTraits<OutputT>::StorageToPluginArg( - output_storage_); - } + const OutputT& output() { return output_storage_.output(); } typename pp::CompletionCallbackWithOutput<OutputT>::OutputStorageType output_storage_; diff --git a/ppapi/thunk/enter.cc b/ppapi/thunk/enter.cc index 965e0f1..0248eba 100644 --- a/ppapi/thunk/enter.cc +++ b/ppapi/thunk/enter.cc @@ -63,9 +63,7 @@ EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id, const PP_CompletionCallback& callback) : resource_(GetSingletonResource(instance, resource_id)), retval_(PP_OK) { - DCHECK(resource_ || !instance); - if (!resource_) - retval_ = PP_ERROR_BADARGUMENT; + DCHECK(resource_); callback_ = new TrackedCallback(resource_, callback); } diff --git a/ppapi/thunk/ppb_truetype_font_thunk.cc b/ppapi/thunk/ppb_truetype_font_thunk.cc index 4b47afb..b941c84 100644 --- a/ppapi/thunk/ppb_truetype_font_thunk.cc +++ b/ppapi/thunk/ppb_truetype_font_thunk.cc @@ -24,8 +24,7 @@ int32_t GetFontFamilies(PP_Instance instance, EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback); if (enter.failed()) return PP_ERROR_FAILED; - return enter.SetResult( - enter.functions()->GetFontFamilies(instance, output, enter.callback())); + return enter.functions()->GetFontFamilies(instance, output, enter.callback()); } PP_Resource Create(PP_Instance instance, |