diff --git a/DEPS b/DEPS index a567f027..dfb60ae9 100644 --- a/DEPS +++ b/DEPS
@@ -149,7 +149,7 @@ Var('chromium_git') + '/external/snappy.git' + '@' + '762bb32f0c9d2f31ba4958c7c0933d22e80c20bf', 'src/tools/gyp': - Var('chromium_git') + '/external/gyp.git' + '@' + '66bbdf4c6b450d55bd9e53fd18d9628a8f328398', + Var('chromium_git') + '/external/gyp.git' + '@' + '5170bfd38fe79bd5b16aa7f6c5439fb90a37ae66', 'src/tools/swarming_client': Var('chromium_git') + '/external/swarming.client.git' + '@' + Var('swarming_revision'), @@ -191,7 +191,7 @@ Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'e6e47f514216bbcdbfe796eb1f398c9afece93c8', 'src/third_party/libjingle/source/talk': - Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '01cbe5bbcb4412882bc787c50c987de64787a37a', # commit position 11522 + Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + 'ae925d4343e1c9768dfa3fcc82022d3f743c6e28', # commit position 11551 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + 'c60ec8b35c3fe6027d7a3faae89d1c8d7dd3ce98', @@ -215,7 +215,7 @@ Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067', 'src/third_party/webrtc': - Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '4def4205b4932e1c3d5f004b67a723345d1674ed', # commit position 11523 + Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + 'bb60460d341e515b6769b2899c11afe15d8b240f', # commit position 11553 'src/third_party/openmax_dl': Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' + Var('openmax_dl_revision'), @@ -275,7 +275,7 @@ 'src/third_party/catapult': Var('chromium_git') + '/external/github.com/catapult-project/catapult.git' + '@' + - '9f61ad391dd016f99c74a11dd55630af6616ef4c', + 'f398a005cf9c61c9ed5ea47ed13fabbe6f2bb91a', 'src/third_party/openh264/src': Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + 'b37cda248234162033e3e11b0335f3131cdfe488',
diff --git a/android_webview/lib/DEPS b/android_webview/lib/DEPS index e46fa53c..572fe0c 100644 --- a/android_webview/lib/DEPS +++ b/android_webview/lib/DEPS
@@ -3,6 +3,7 @@ "+components", # For jni registers. "+content/public", "+gin/public", + "+gin/v8_initializer.h", "+media/base/media_switches.h", # For media command line switches. "+ui/events/gesture_detection", "+ui/gl",
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc index e0025feb..e858652 100644 --- a/android_webview/lib/main/aw_main_delegate.cc +++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -34,6 +34,7 @@ #include "content/public/common/content_descriptors.h" #include "content/public/common/content_switches.h" #include "gin/public/isolate_holder.h" +#include "gin/v8_initializer.h" #include "gpu/command_buffer/client/gl_in_process_context.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "media/base/media_switches.h" @@ -117,24 +118,19 @@ if (cl->GetSwitchValueASCII(switches::kProcessType).empty()) { // Browser process (no type specified). - // This code is needed to be able to mmap the V8 snapshot directly from - // the WebView .apk using architecture-specific names. - // This needs to be here so that it gets to run before the code in - // content_main_runner that reads these values tries to do so. -#ifdef __LP64__ - const char kNativesFileName[] = "assets/natives_blob_64.bin"; - const char kSnapshotFileName[] = "assets/snapshot_blob_64.bin"; -#else - const char kNativesFileName[] = "assets/natives_blob_32.bin"; - const char kSnapshotFileName[] = "assets/snapshot_blob_32.bin"; -#endif // __LP64__ - // TODO(gsennton) we should use - // gin::IsolateHolder::kNativesFileName/kSnapshotFileName - // here when those files have arch specific names http://crbug.com/455699 - CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( - kV8NativesDataDescriptor, kNativesFileName)); - CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( - kV8SnapshotDataDescriptor, kSnapshotFileName)); + base::android::RegisterApkAssetWithGlobalDescriptors( + kV8NativesDataDescriptor32, + gin::V8Initializer::GetNativesFilePath(true).AsUTF8Unsafe()); + base::android::RegisterApkAssetWithGlobalDescriptors( + kV8SnapshotDataDescriptor32, + gin::V8Initializer::GetSnapshotFilePath(true).AsUTF8Unsafe()); + + base::android::RegisterApkAssetWithGlobalDescriptors( + kV8NativesDataDescriptor64, + gin::V8Initializer::GetNativesFilePath(false).AsUTF8Unsafe()); + base::android::RegisterApkAssetWithGlobalDescriptors( + kV8SnapshotDataDescriptor64, + gin::V8Initializer::GetSnapshotFilePath(false).AsUTF8Unsafe()); } if (cl->HasSwitch(switches::kWebViewSandboxedRenderer)) {
diff --git a/ash/mus/sysui_application.cc b/ash/mus/sysui_application.cc index 1533911..094e8d19f 100644 --- a/ash/mus/sysui_application.cc +++ b/ash/mus/sysui_application.cc
@@ -98,10 +98,24 @@ static_cast<int32_t>(container)); } } + + // AshInit installs a stub implementation of ui::ContextFactory, so that the + // AshWindowTreeHost instances created do not actually show anything to the + // user. However, when creating a views::Widget instance, the + // WindowManagerConnection creates a WindowTreeHostMus instance, which + // creates a ui::Compositor, and it needs a real ui::ContextFactory + // implementation. So, unset the context-factory here temporarily when + // creating NativeWidgetMus. But restore the stub instance afterwards, so + // that it is used when new AshWindowTreeHost instances are created (e.g. + // when a new monitor is attached). + ui::ContextFactory* factory = aura::Env::GetInstance()->context_factory(); + aura::Env::GetInstance()->set_context_factory(nullptr); views::NativeWidgetMus* native_widget = static_cast<views::NativeWidgetMus*>( views::WindowManagerConnection::Get()->CreateNativeWidgetMus( properties, params, delegate)); + aura::Env::GetInstance()->set_context_factory(factory); + // TODO: Set the correct display id here. InitRootWindowSettings(native_widget->GetRootWindow())->display_id = Shell::GetInstance() @@ -157,9 +171,6 @@ ash::Shell::GetInstance()->CreateShelf(); ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( ash::user::LOGGED_IN_USER); - // Reset the context factory, so that NativeWidgetMus installs the context - // factory for the views::Widgets correctly. - aura::Env::GetInstance()->set_context_factory(nullptr); ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); SetupWallpaper(SkColorSetARGB(255, 0, 255, 0));
diff --git a/base/BUILD.gn b/base/BUILD.gn index 3bafc89..7a6c73aa 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -52,6 +52,15 @@ "/DELAYLOAD:setupapi.dll", ] } + + copy("copy_dbghelp.dll") { + sources = [ + "../build/win/dbghelp_xp/dbghelp.dll", + ] + outputs = [ + "$root_out_dir/{{source_file_part}}", + ] + } } if (is_nacl_nonsfi) { @@ -1111,7 +1120,10 @@ # Required for base/stack_trace_win.cc to symbolize correctly. data += [ "$root_build_dir/dbghelp.dll" ] - deps += [ "//base/trace_event/etw_manifest:chrome_events_win" ] + deps += [ + ":copy_dbghelp.dll", + "//base/trace_event/etw_manifest:chrome_events_win", + ] if (is_component_build) { # Copy the VS runtime DLLs into the isolate so that they don't have to be
diff --git a/base/android/java/src/org/chromium/base/library_loader/ModernLinker.java b/base/android/java/src/org/chromium/base/library_loader/ModernLinker.java index 152965b..5abc4e5 100644 --- a/base/android/java/src/org/chromium/base/library_loader/ModernLinker.java +++ b/base/android/java/src/org/chromium/base/library_loader/ModernLinker.java
@@ -61,6 +61,9 @@ // The map of libraries that are currently loaded in this process. private HashMap<String, LibInfo> mLoadedLibraries = null; + // The directory used to hold shared RELRO data files. Set up by prepareLibraryLoad(). + private String mDataDirectory = null; + // Private singleton constructor, and singleton factory method. private ModernLinker() { } static Linker create() { @@ -118,6 +121,9 @@ // Create an empty loaded libraries map. mLoadedLibraries = new HashMap<String, LibInfo>(); + // Retrieve the data directory from base. + mDataDirectory = PathUtils.getDataDirectory(null); + // Start the current load address at the base load address. mCurrentLoadAddress = mBaseLoadAddress; @@ -391,7 +397,7 @@ // We are in the browser, and with a current load address that indicates that // there is enough address space for shared RELRO to operate. Create the // shared RELRO, and store it in the map. - String relroPath = PathUtils.getDataDirectory(null) + "/RELRO:" + libFilePath; + String relroPath = mDataDirectory + "/RELRO:" + libFilePath; if (nativeCreateSharedRelro(dlopenExtPath, mCurrentLoadAddress, relroPath, libInfo)) { mSharedRelros.put(dlopenExtPath, libInfo);
diff --git a/base/android/jni_array.cc b/base/android/jni_array.cc index af8f5d2..2ce0429 100644 --- a/base/android/jni_array.cc +++ b/base/android/jni_array.cc
@@ -84,6 +84,26 @@ return ToJavaLongArray(env, longs.data(), longs.size()); } +// Returns a new Java float array converted from the given C++ float array. +BASE_EXPORT ScopedJavaLocalRef<jfloatArray> ToJavaFloatArray( + JNIEnv* env, const float* floats, size_t len) { + jfloatArray float_array = env->NewFloatArray(len); + CheckException(env); + DCHECK(float_array); + + env->SetFloatArrayRegion( + float_array, 0, len, reinterpret_cast<const jfloat*>(floats)); + CheckException(env); + + return ScopedJavaLocalRef<jfloatArray>(env, float_array); +} + +BASE_EXPORT ScopedJavaLocalRef<jfloatArray> ToJavaFloatArray( + JNIEnv* env, + const std::vector<float>& floats) { + return ToJavaFloatArray(env, floats.data(), floats.size()); +} + ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( JNIEnv* env, const std::vector<std::string>& v) { ScopedJavaLocalRef<jclass> byte_array_clazz = GetClass(env, "[B");
diff --git a/base/android/jni_array.h b/base/android/jni_array.h index 34e5bba..58282b1b 100644 --- a/base/android/jni_array.h +++ b/base/android/jni_array.h
@@ -42,6 +42,14 @@ JNIEnv* env, const std::vector<int64_t>& longs); +// Returns a new Java float array converted from the given C++ float array. +BASE_EXPORT ScopedJavaLocalRef<jfloatArray> ToJavaFloatArray( + JNIEnv* env, const float* floats, size_t len); + +BASE_EXPORT ScopedJavaLocalRef<jfloatArray> ToJavaFloatArray( + JNIEnv* env, + const std::vector<float>& floats); + // Returns a array of Java byte array converted from |v|. BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( JNIEnv* env, const std::vector<std::string>& v);
diff --git a/base/android/jni_array_unittest.cc b/base/android/jni_array_unittest.cc index 47f1afc..09de242 100644 --- a/base/android/jni_array_unittest.cc +++ b/base/android/jni_array_unittest.cc
@@ -113,6 +113,35 @@ } } +void CheckFloatConversion( + JNIEnv* env, + const float* float_array, + const size_t len, + const ScopedJavaLocalRef<jfloatArray>& floats) { + ASSERT_TRUE(floats.obj()); + + jsize java_array_len = env->GetArrayLength(floats.obj()); + ASSERT_EQ(static_cast<jsize>(len), java_array_len); + + jfloat value; + for (size_t i = 0; i < len; ++i) { + env->GetFloatArrayRegion(floats.obj(), i, 1, &value); + ASSERT_EQ(float_array[i], value); + } +} + +TEST(JniArray, FloatConversions) { + const float kFloats[] = { 0.0f, 1.0f, -10.0f}; + const size_t kLen = arraysize(kFloats); + + JNIEnv* env = AttachCurrentThread(); + CheckFloatConversion(env, kFloats, kLen, + ToJavaFloatArray(env, kFloats, kLen)); + + const std::vector<float> vec(kFloats, kFloats + kLen); + CheckFloatConversion(env, kFloats, kLen, ToJavaFloatArray(env, vec)); +} + TEST(JniArray, JavaIntArrayToIntVector) { const int kInts[] = {0, 1, -1}; const size_t kLen = arraysize(kInts);
diff --git a/base/bind.h b/base/bind.h index c6b73936..3a20feb 100644 --- a/base/bind.h +++ b/base/bind.h
@@ -46,12 +46,26 @@ namespace base { +namespace internal { + +// Don't use Alias Template directly here to avoid a compile error on MSVC2013. template <typename Functor, typename... Args> -base::Callback< - typename internal::BindState< - typename internal::FunctorTraits<Functor>::RunnableType, - typename internal::FunctorTraits<Functor>::RunType, - typename std::decay<Args>::type...>::UnboundRunType> +struct MakeUnboundRunTypeImpl { + using Type = + typename BindState< + typename FunctorTraits<Functor>::RunnableType, + typename FunctorTraits<Functor>::RunType, + typename std::decay<Args>::type...>::UnboundRunType; +}; + +} // namespace internal + +template <typename Functor, typename... Args> +using MakeUnboundRunType = + typename internal::MakeUnboundRunTypeImpl<Functor, Args...>::Type; + +template <typename Functor, typename... Args> +base::Callback<MakeUnboundRunType<Functor, Args...>> Bind(Functor functor, Args&&... args) { // Type aliases for how to store and run the functor. using RunnableType = typename internal::FunctorTraits<Functor>::RunnableType;
diff --git a/base/trace_event/trace_buffer.cc b/base/trace_event/trace_buffer.cc index e96699f6..9630a7a 100644 --- a/base/trace_event/trace_buffer.cc +++ b/base/trace_event/trace_buffer.cc
@@ -99,19 +99,6 @@ return NULL; } - scoped_ptr<TraceBuffer> CloneForIteration() const override { - scoped_ptr<ClonedTraceBuffer> cloned_buffer(new ClonedTraceBuffer()); - for (size_t queue_index = queue_head_; queue_index != queue_tail_; - queue_index = NextQueueIndex(queue_index)) { - size_t chunk_index = recyclable_chunks_queue_[queue_index]; - if (chunk_index >= chunks_.size()) // Skip uninitialized chunks. - continue; - TraceBufferChunk* chunk = chunks_[chunk_index].get(); - cloned_buffer->chunks_.push_back(chunk ? chunk->Clone() : NULL); - } - return std::move(cloned_buffer); - } - void EstimateTraceMemoryOverhead( TraceEventMemoryOverhead* overhead) override { overhead->Add("TraceBufferRingBuffer", sizeof(*this)); @@ -125,43 +112,6 @@ } private: - class ClonedTraceBuffer : public TraceBuffer { - public: - ClonedTraceBuffer() : current_iteration_index_(0) {} - - // The only implemented method. - const TraceBufferChunk* NextChunk() override { - return current_iteration_index_ < chunks_.size() - ? chunks_[current_iteration_index_++].get() - : NULL; - } - - scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { - NOTIMPLEMENTED(); - return scoped_ptr<TraceBufferChunk>(); - } - void ReturnChunk(size_t index, scoped_ptr<TraceBufferChunk>) override { - NOTIMPLEMENTED(); - } - bool IsFull() const override { return false; } - size_t Size() const override { return 0; } - size_t Capacity() const override { return 0; } - TraceEvent* GetEventByHandle(TraceEventHandle handle) override { - return NULL; - } - scoped_ptr<TraceBuffer> CloneForIteration() const override { - NOTIMPLEMENTED(); - return scoped_ptr<TraceBuffer>(); - } - void EstimateTraceMemoryOverhead( - TraceEventMemoryOverhead* overhead) override { - NOTIMPLEMENTED(); - } - - size_t current_iteration_index_; - std::vector<scoped_ptr<TraceBufferChunk>> chunks_; - }; - bool QueueIsEmpty() const { return queue_head_ == queue_tail_; } size_t QueueSize() const { @@ -257,11 +207,6 @@ return NULL; } - scoped_ptr<TraceBuffer> CloneForIteration() const override { - NOTIMPLEMENTED(); - return scoped_ptr<TraceBuffer>(); - } - void EstimateTraceMemoryOverhead( TraceEventMemoryOverhead* overhead) override { const size_t chunks_ptr_vector_allocated_size = @@ -308,14 +253,6 @@ return &chunk_[*event_index]; } -scoped_ptr<TraceBufferChunk> TraceBufferChunk::Clone() const { - scoped_ptr<TraceBufferChunk> cloned_chunk(new TraceBufferChunk(seq_)); - cloned_chunk->next_free_ = next_free_; - for (size_t i = 0; i < next_free_; ++i) - cloned_chunk->chunk_[i].CopyFrom(chunk_[i]); - return cloned_chunk; -} - void TraceBufferChunk::EstimateTraceMemoryOverhead( TraceEventMemoryOverhead* overhead) { if (!cached_overhead_estimate_) {
diff --git a/base/trace_event/trace_buffer.h b/base/trace_event/trace_buffer.h index a7b80595..c4c1c2b 100644 --- a/base/trace_event/trace_buffer.h +++ b/base/trace_event/trace_buffer.h
@@ -39,8 +39,6 @@ return &chunk_[index]; } - scoped_ptr<TraceBufferChunk> Clone() const; - void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); // These values must be kept consistent with the numbers of bits of @@ -73,7 +71,6 @@ // For iteration. Each TraceBuffer can only be iterated once. virtual const TraceBufferChunk* NextChunk() = 0; - virtual scoped_ptr<TraceBuffer> CloneForIteration() const = 0; // Computes an estimate of the size of the buffer, including all the retained // objects.
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc index d407b04..a39c190 100644 --- a/base/trace_event/trace_event_unittest.cc +++ b/base/trace_event/trace_event_unittest.cc
@@ -134,19 +134,6 @@ base::Unretained(flush_complete_event))); } - void FlushMonitoring() { - WaitableEvent flush_complete_event(false, false); - FlushMonitoring(&flush_complete_event); - flush_complete_event.Wait(); - } - - void FlushMonitoring(WaitableEvent* flush_complete_event) { - TraceLog::GetInstance()->FlushButLeaveBufferIntact( - base::Bind(&TraceEventTestFixture::OnTraceDataCollected, - base::Unretained(static_cast<TraceEventTestFixture*>(this)), - base::Unretained(flush_complete_event))); - } - void SetUp() override { const char* name = PlatformThread::GetName(); old_thread_name_ = name ? strdup(name) : NULL; @@ -1275,25 +1262,6 @@ BeginTrace(); EndTraceAndFlush(); ASSERT_EQ(1, num_calls); - - // Flushing should cause |AppendAsTraceFormat| to be called, but if the buffer - // is left intact, it the flush at the end of the trace should still call it; - // the metadata event should not be removed. - TraceLog::GetInstance()->SetEnabled( - TraceConfig(kRecordAllCategoryFilter, - "record-until-full,enable-sampling"), - TraceLog::MONITORING_MODE); - TRACE_EVENT_API_ADD_METADATA_EVENT("metadata_event_name", "metadata_arg_name", - convertable); - FlushMonitoring(); - ASSERT_EQ(2, num_calls); - - // Flushing the trace at this point will case |AppendAsTraceFormat| to be - // called twice: once for the event that was added by the monitoring flush, - // and once for the end trace flush; the metadata event will be duplicated. - // This is consistent with the other metadata events. - EndTraceAndFlush(); - ASSERT_EQ(4, num_calls); } // Test that categories work. @@ -2059,52 +2027,6 @@ EndTraceAndFlush(); } -TEST_F(TraceEventTestFixture, TraceContinuousSampling) { - TraceLog::GetInstance()->SetEnabled( - TraceConfig(kRecordAllCategoryFilter, "record-until-full,enable-sampling"), - TraceLog::MONITORING_MODE); - - TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "AAA"); - TraceLog::GetInstance()->WaitSamplingEventForTesting(); - TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "BBB"); - TraceLog::GetInstance()->WaitSamplingEventForTesting(); - - FlushMonitoring(); - - // Make sure we can get the profiled data. - EXPECT_TRUE(FindNamePhase("AAA", "P")); - EXPECT_TRUE(FindNamePhase("BBB", "P")); - - Clear(); - TraceLog::GetInstance()->WaitSamplingEventForTesting(); - - TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "CCC"); - TraceLog::GetInstance()->WaitSamplingEventForTesting(); - TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "DDD"); - TraceLog::GetInstance()->WaitSamplingEventForTesting(); - - FlushMonitoring(); - - // Make sure the profiled data is accumulated. - EXPECT_TRUE(FindNamePhase("AAA", "P")); - EXPECT_TRUE(FindNamePhase("BBB", "P")); - EXPECT_TRUE(FindNamePhase("CCC", "P")); - EXPECT_TRUE(FindNamePhase("DDD", "P")); - - Clear(); - - TraceLog::GetInstance()->SetDisabled(); - - // Make sure disabling the continuous sampling thread clears - // the profiled data. - EXPECT_FALSE(FindNamePhase("AAA", "P")); - EXPECT_FALSE(FindNamePhase("BBB", "P")); - EXPECT_FALSE(FindNamePhase("CCC", "P")); - EXPECT_FALSE(FindNamePhase("DDD", "P")); - - Clear(); -} - class MyData : public ConvertableToTraceFormat { public: MyData() {}
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc index 6ece72ff..ae80938 100644 --- a/base/trace_event/trace_log.cc +++ b/base/trace_event/trace_log.cc
@@ -78,8 +78,6 @@ "Too many vector buffer chunks"); const size_t kTraceEventRingBufferChunks = kTraceEventVectorBufferChunks / 4; -// Can store results for 30 seconds with 1 ms sampling interval. -const size_t kMonitorTraceEventBufferChunks = 30000 / kTraceBufferChunkSize; // ECHO_TO_CONSOLE needs a small buffer to hold the unfinished COMPLETE events. const size_t kEchoToConsoleTraceEventBufferChunks = 256; @@ -453,14 +451,15 @@ unsigned char enabled_flag = 0; const char* category_group = g_category_groups[category_index]; if (mode_ == RECORDING_MODE && - trace_config_.IsCategoryGroupEnabled(category_group)) + trace_config_.IsCategoryGroupEnabled(category_group)) { enabled_flag |= ENABLED_FOR_RECORDING; - else if (mode_ == MONITORING_MODE && - trace_config_.IsCategoryGroupEnabled(category_group)) - enabled_flag |= ENABLED_FOR_MONITORING; + } + if (event_callback_ && - event_callback_trace_config_.IsCategoryGroupEnabled(category_group)) + event_callback_trace_config_.IsCategoryGroupEnabled(category_group)) { enabled_flag |= ENABLED_FOR_EVENT_CALLBACK; + } + #if defined(OS_WIN) if (base::trace_event::TraceEventETWExport::IsCategoryGroupEnabled( category_group)) { @@ -1018,31 +1017,6 @@ FinishFlush(generation, discard_events); } -void TraceLog::FlushButLeaveBufferIntact( - const TraceLog::OutputCallback& flush_output_callback) { - scoped_ptr<TraceBuffer> previous_logged_events; - ArgumentFilterPredicate argument_filter_predicate; - { - AutoLock lock(lock_); - AddMetadataEventsWhileLocked(); - if (thread_shared_chunk_) { - // Return the chunk to the main buffer to flush the sampling data. - logged_events_->ReturnChunk(thread_shared_chunk_index_, - std::move(thread_shared_chunk_)); - } - previous_logged_events = logged_events_->CloneForIteration(); - - if (trace_options() & kInternalEnableArgumentFilter) { - CHECK(!argument_filter_predicate_.is_null()); - argument_filter_predicate = argument_filter_predicate_; - } - } // release lock - - ConvertTraceEventsToTraceFormat(std::move(previous_logged_events), - flush_output_callback, - argument_filter_predicate); -} - void TraceLog::UseNextTraceBuffer() { logged_events_.reset(CreateTraceBuffer()); subtle::NoBarrier_AtomicIncrement(&generation_, 1); @@ -1269,8 +1243,7 @@ #endif // OS_WIN std::string console_message; - if (*category_group_enabled & - (ENABLED_FOR_RECORDING | ENABLED_FOR_MONITORING)) { + if (*category_group_enabled & ENABLED_FOR_RECORDING) { OptionalAutoLock lock(&lock_); TraceEvent* trace_event = NULL; @@ -1685,9 +1658,6 @@ if (options & kInternalRecordContinuously) return TraceBuffer::CreateTraceBufferRingBuffer( kTraceEventRingBufferChunks); - else if ((options & kInternalEnableSampling) && mode_ == MONITORING_MODE) - return TraceBuffer::CreateTraceBufferRingBuffer( - kMonitorTraceEventBufferChunks); else if (options & kInternalEchoToConsole) return TraceBuffer::CreateTraceBufferRingBuffer( kEchoToConsoleTraceEventBufferChunks);
diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h index c849d4d..7d2d748 100644 --- a/base/trace_event/trace_log.h +++ b/base/trace_event/trace_log.h
@@ -47,8 +47,7 @@ public: enum Mode { DISABLED = 0, - RECORDING_MODE, - MONITORING_MODE, + RECORDING_MODE }; // The pointer returned from GetCategoryGroupEnabledInternal() points to a @@ -58,8 +57,6 @@ enum CategoryGroupEnabledFlags { // Category group enabled for the recording mode. ENABLED_FOR_RECORDING = 1 << 0, - // Category group enabled for the monitoring mode. - ENABLED_FOR_MONITORING = 1 << 1, // Category group enabled by SetEventCallbackEnabled(). ENABLED_FOR_EVENT_CALLBACK = 1 << 2, // Category group enabled to export events to ETW. @@ -170,7 +167,6 @@ typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&, bool has_more_events)> OutputCallback; void Flush(const OutputCallback& cb, bool use_worker_thread = false); - void FlushButLeaveBufferIntact(const OutputCallback& flush_output_callback); // Cancels tracing and discards collected data. void CancelTracing(const OutputCallback& cb);
diff --git a/build/android/incremental_install/installer.py b/build/android/incremental_install/installer.py index feebadb..b5b1d05 100755 --- a/build/android/incremental_install/installer.py +++ b/build/android/incremental_install/installer.py
@@ -13,6 +13,7 @@ import posixpath import shutil import sys +import zipfile sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))) @@ -63,6 +64,12 @@ return '/data/local/tmp/incremental-app-%s' % package +def _HasClasses(jar_path): + """Returns whether the given jar contains classes.dex.""" + with zipfile.ZipFile(jar_path) as jar: + return 'classes.dex' in jar.namelist() + + def Uninstall(device, package, enable_device_cache=False): """Uninstalls and removes all incremental files for the given package.""" main_timer = time_profile.TimeProfile() @@ -138,7 +145,10 @@ # Ensure no two files have the same name. transformed_names = _TransformDexPaths(dex_files) for src_path, dest_name in zip(dex_files, transformed_names): - shutil.copy(src_path, os.path.join(temp_dir, dest_name)) + # Binary targets with no extra classes create .dex.jar without a + # classes.dex (which Android chokes on). + if _HasClasses(src_path): + shutil.copy(src_path, os.path.join(temp_dir, dest_name)) device.PushChangedFiles([(temp_dir, device_dex_dir)], delete_device_stale=True) push_dex_timer.Stop(log=False)
diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java index 7c9bcca2..1fb5e40b 100644 --- a/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java +++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java
@@ -37,6 +37,7 @@ private ClassLoaderPatcher mClassLoaderPatcher; private Application mRealApplication; + private Instrumentation mOrigInstrumentation; private Instrumentation mRealInstrumentation; private Object mStashedProviderList; private Object mActivityThread; @@ -44,41 +45,76 @@ @Override protected void attachBaseContext(Context context) { super.attachBaseContext(context); - File incrementalRootDir = new File(MANAGED_DIR_PREFIX + context.getPackageName()); - File libDir = new File(incrementalRootDir, "lib"); - File dexDir = new File(incrementalRootDir, "dex"); - File installLockFile = new File(incrementalRootDir, "install.lock"); - File firstRunLockFile = new File(incrementalRootDir, "firstrun.lock"); - try { mActivityThread = Reflect.invokeMethod(Class.forName("android.app.ActivityThread"), "currentActivityThread"); mClassLoaderPatcher = new ClassLoaderPatcher(context); - boolean isFirstRun = LockFile.installerLockExists(firstRunLockFile); + mOrigInstrumentation = + (Instrumentation) Reflect.getField(mActivityThread, "mInstrumentation"); + Context instContext = mOrigInstrumentation.getContext(); + if (instContext == null) { + instContext = context; + } + + // When running with an instrumentation that lives in a different package from the + // application, we must load the dex files and native libraries from both pacakges. + // This logic likely won't work when the instrumentation is incremental, but the app is + // non-incremental. This configuration isn't used right now though. + String appPackageName = getPackageName(); + String instPackageName = instContext.getPackageName(); + boolean instPackageNameDiffers = !appPackageName.equals(instPackageName); + Log.i(TAG, "App PackageName: " + appPackageName); + if (instPackageNameDiffers) { + Log.i(TAG, "Inst PackageName: " + instPackageName); + } + + File appIncrementalRootDir = new File(MANAGED_DIR_PREFIX + appPackageName); + File appLibDir = new File(appIncrementalRootDir, "lib"); + File appDexDir = new File(appIncrementalRootDir, "dex"); + File appInstallLockFile = new File(appIncrementalRootDir, "install.lock"); + File appFirstRunLockFile = new File(appIncrementalRootDir, "firstrun.lock"); + File instIncrementalRootDir = new File(MANAGED_DIR_PREFIX + instPackageName); + File instLibDir = new File(instIncrementalRootDir, "lib"); + File instDexDir = new File(instIncrementalRootDir, "dex"); + File instInstallLockFile = new File(instIncrementalRootDir, "install.lock"); + File instFirstRunLockFile = new File(instIncrementalRootDir , "firstrun.lock"); + + boolean isFirstRun = LockFile.installerLockExists(appFirstRunLockFile) + || (instPackageNameDiffers + && LockFile.installerLockExists(instFirstRunLockFile)); if (isFirstRun) { if (mClassLoaderPatcher.mIsPrimaryProcess) { // Wait for incremental_install.py to finish. - LockFile.waitForInstallerLock(installLockFile, 30 * 1000); + LockFile.waitForInstallerLock(appInstallLockFile, 30 * 1000); + LockFile.waitForInstallerLock(instInstallLockFile, 30 * 1000); } else { // Wait for the browser process to create the optimized dex files // and copy the library files. - LockFile.waitForInstallerLock(firstRunLockFile, 60 * 1000); + LockFile.waitForInstallerLock(appFirstRunLockFile, 60 * 1000); + LockFile.waitForInstallerLock(instFirstRunLockFile, 60 * 1000); } } - mClassLoaderPatcher.importNativeLibs(libDir); - mClassLoaderPatcher.loadDexFiles(dexDir); + mClassLoaderPatcher.importNativeLibs(instLibDir); + mClassLoaderPatcher.loadDexFiles(instDexDir); + if (instPackageNameDiffers) { + mClassLoaderPatcher.importNativeLibs(appLibDir); + mClassLoaderPatcher.loadDexFiles(appDexDir); + } if (isFirstRun && mClassLoaderPatcher.mIsPrimaryProcess) { - LockFile.clearInstallerLock(firstRunLockFile); + LockFile.clearInstallerLock(appFirstRunLockFile); + if (instPackageNameDiffers) { + LockFile.clearInstallerLock(instFirstRunLockFile); + } } // mInstrumentationAppDir is one of a set of fields that is initialized only when // instrumentation is active. if (Reflect.getField(mActivityThread, "mInstrumentationAppDir") != null) { String realInstrumentationName = - getClassNameFromMetadata(REAL_INSTRUMENTATION_META_DATA_NAME); + getClassNameFromMetadata(REAL_INSTRUMENTATION_META_DATA_NAME, instContext); initInstrumentation(realInstrumentationName); } else { Log.i(TAG, "No instrumentation active."); @@ -93,7 +129,7 @@ // attachBaseContext() is called from ActivityThread#handleBindApplication() and // Application#mApplication is changed right after we return. Thus, we cannot swap // the Application instances until onCreate() is called. - String realApplicationName = getClassNameFromMetadata(REAL_APP_META_DATA_NAME); + String realApplicationName = getClassNameFromMetadata(REAL_APP_META_DATA_NAME, context); Log.i(TAG, "Instantiating " + realApplicationName); mRealApplication = (Application) Reflect.newInstance(Class.forName(realApplicationName)); @@ -114,12 +150,14 @@ * Returns the fully-qualified class name for the given key, stored in a * <meta> witin the manifest. */ - private String getClassNameFromMetadata(String key) throws NameNotFoundException { - ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(), + private static String getClassNameFromMetadata(String key, Context context) + throws NameNotFoundException { + String pkgName = context.getPackageName(); + ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(pkgName, PackageManager.GET_META_DATA); String value = appInfo.metaData.getString(key); if (value != null && !value.contains(".")) { - value = getPackageName() + "." + value; + value = pkgName + "." + value; } return value; } @@ -129,14 +167,12 @@ */ private void initInstrumentation(String realInstrumentationName) throws ReflectiveOperationException { - Instrumentation oldInstrumentation = - (Instrumentation) Reflect.getField(mActivityThread, "mInstrumentation"); if (realInstrumentationName == null) { // This is the case when an incremental app is used as a target for an instrumentation // test. In this case, ActivityThread can instantiate the proper class just fine since // it exists within the test apk (as opposed to the incremental apk-under-test). Log.i(TAG, "Running with external instrumentation"); - mRealInstrumentation = oldInstrumentation; + mRealInstrumentation = mOrigInstrumentation; return; } // For unit tests, the instrumentation class is replaced in the manifest by a build step @@ -151,11 +187,11 @@ "mWatcher", "mUiAutomationConnection"}; for (String fieldName : initFields) { Reflect.setField(mRealInstrumentation, fieldName, - Reflect.getField(oldInstrumentation, fieldName)); + Reflect.getField(mOrigInstrumentation, fieldName)); } // But make sure the correct ComponentName is used. ComponentName newName = new ComponentName( - oldInstrumentation.getComponentName().getPackageName(), realInstrumentationName); + mOrigInstrumentation.getComponentName().getPackageName(), realInstrumentationName); Reflect.setField(mRealInstrumentation, "mComponent", newName); }
diff --git a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java index c1682e8..c382799 100644 --- a/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java +++ b/build/android/incremental_install/java/org/chromium/incrementalinstall/ClassLoaderPatcher.java
@@ -103,6 +103,10 @@ */ void importNativeLibs(File libDir) throws ReflectiveOperationException, IOException { Log.i(TAG, "Importing native libraries from: " + libDir); + if (!libDir.exists()) { + Log.i(TAG, "No native libs exist."); + return; + } // The library copying is not necessary on older devices, but we do it anyways to // simplify things (it's fast compared to dexing). // https://code.google.com/p/android/issues/detail?id=79480 @@ -169,28 +173,34 @@ private static void copyChangedFiles(File srcDir, File dstDir) throws IOException { // No need to delete stale libs since libraries are loaded explicitly. + int numNotChanged = 0; for (File f : srcDir.listFiles()) { // Note: Tried using hardlinks, but resulted in EACCES exceptions. File dest = new File(dstDir, f.getName()); - copyIfModified(f, dest); + if (!copyIfModified(f, dest)) { + numNotChanged++; + } + } + if (numNotChanged > 0) { + Log.i(TAG, numNotChanged + " libs already up-to-date."); } } - private static void copyIfModified(File src, File dest) throws IOException { + private static boolean copyIfModified(File src, File dest) throws IOException { long lastModified = src.lastModified(); - if (!dest.exists() || dest.lastModified() != lastModified) { - Log.i(TAG, "Copying " + src + " -> " + dest); - FileInputStream istream = new FileInputStream(src); - FileOutputStream ostream = new FileOutputStream(dest); - ostream.getChannel().transferFrom(istream.getChannel(), 0, istream.getChannel().size()); - istream.close(); - ostream.close(); - dest.setReadable(true, false); - dest.setExecutable(true, false); - dest.setLastModified(lastModified); - } else { - Log.i(TAG, "Up-to-date: " + dest); + if (dest.exists() && dest.lastModified() == lastModified) { + return false; } + Log.i(TAG, "Copying " + src + " -> " + dest); + FileInputStream istream = new FileInputStream(src); + FileOutputStream ostream = new FileOutputStream(dest); + ostream.getChannel().transferFrom(istream.getChannel(), 0, istream.getChannel().size()); + istream.close(); + ostream.close(); + dest.setReadable(true, false); + dest.setExecutable(true, false); + dest.setLastModified(lastModified); + return true; } private void ensureAppFilesSubDirExists() {
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py index 00df8efc..c42a852 100755 --- a/build/android/resource_sizes.py +++ b/build/android/resource_sizes.py
@@ -37,24 +37,6 @@ # using 'nm' on libchrome.so which results from a GCC official build (i.e. # Clang is not supported currently). -STATIC_INITIALIZER_SYMBOL_PREFIX = '_GLOBAL__I_' - -EXPECTED_STATIC_INITIALIZERS = frozenset([ - 'allocators.cpp', - 'common.pb.cc', - 'defaults.cc', - 'generated_message_util.cc', - 'locale_impl.cpp', - 'timeutils.cc', - 'watchdog.cc', - # http://b/6354040 - 'SkFontHost_android.cpp', - # http://b/6354040 - 'isolate.cc', - 'assembler_arm.cc', - 'isolate.cc', -]) - _BASE_CHART = { 'format_version': '0.1', 'benchmark_name': 'resource_sizes', @@ -62,23 +44,47 @@ 'trace_rerun_options': [], 'charts': {} } - +_DUMP_STATIC_INITIALIZERS_PATH = os.path.join( + host_paths.DIR_SOURCE_ROOT, 'tools', 'linux', 'dump-static-initializers.py') _RC_HEADER_RE = re.compile(r'^#define (?P<name>\w+) (?P<id>\d+)$') +def CountStaticInitializers(so_path): + def get_elf_section_size(readelf_stdout, section_name): + # Matches: .ctors PROGBITS 000000000516add0 5169dd0 000010 00 WA 0 0 8 + match = re.search(r'\.%s.*$' % re.escape(section_name), + readelf_stdout, re.MULTILINE) + if not match: + return (False, -1) + size_str = re.split(r'\W+', match.group(0))[5] + return (True, int(size_str, 16)) + + # Find the number of files with at least one static initializer. + # First determine if we're 32 or 64 bit + stdout = cmd_helper.GetCmdOutput(['readelf', '-h', so_path]) + elf_class_line = re.search('Class:.*$', stdout, re.MULTILINE).group(0) + elf_class = re.split(r'\W+', elf_class_line)[1] + if elf_class == 'ELF32': + word_size = 4 + else: + word_size = 8 + + # Then find the number of files with global static initializers. + # NOTE: this is very implementation-specific and makes assumptions + # about how compiler and linker implement global static initializers. + si_count = 0 + stdout = cmd_helper.GetCmdOutput(['readelf', '-SW', so_path]) + has_init_array, init_array_size = get_elf_section_size(stdout, 'init_array') + if has_init_array: + si_count = init_array_size / word_size + si_count = max(si_count, 0) + return si_count + + def GetStaticInitializers(so_path): - """Returns a list of static initializers found in the non-stripped library - located at the provided path. Note that this function assumes that the - library was compiled with GCC. - """ - output = cmd_helper.GetCmdOutput(['nm', so_path]) - static_initializers = [] - for line in output: - symbol_name = line.split(' ').pop().rstrip() - if STATIC_INITIALIZER_SYMBOL_PREFIX in symbol_name: - static_initializers.append( - symbol_name.replace(STATIC_INITIALIZER_SYMBOL_PREFIX, '')) - return static_initializers + output = cmd_helper.GetCmdOutput([_DUMP_STATIC_INITIALIZERS_PATH, '-d', + so_path]) + return output.splitlines() def ReportPerfResult(chart_data, graph_title, trace_title, value, units, @@ -307,13 +313,21 @@ Args: so_with_symbols_path: Path to the unstripped libchrome.so file. """ - print 'Files with static initializers:' + # GetStaticInitializers uses get-static-initializers.py to get a list of all + # static initializers. This does not work on all archs (particularly arm). + # TODO(rnephew): Get rid of warning when crbug.com/585588 is fixed. + si_count = CountStaticInitializers(so_with_symbols_path) static_initializers = GetStaticInitializers(so_with_symbols_path) + if si_count != len(static_initializers): + print ('There are %d files with static initializers, but ' + 'dump-static-initializers found %d:' % + (si_count, len(static_initializers))) + else: + print 'Found %d files with static initializers:' % si_count print '\n'.join(static_initializers) ReportPerfResult(chartjson, 'StaticInitializersCount', 'count', - len(static_initializers), 'count') - + si_count, 'count') def _FormatBytes(byts): """Pretty-print a number of bytes."""
diff --git a/cc/input/scroll_state.cc b/cc/input/scroll_state.cc index 419b590..763e1b2a 100644 --- a/cc/input/scroll_state.cc +++ b/cc/input/scroll_state.cc
@@ -10,31 +10,6 @@ namespace cc { -ScrollState::ScrollState(double delta_x, - double delta_y, - int start_position_x, - int start_position_y, - double velocity_x, - double velocity_y, - bool is_beginning, - bool is_in_inertial_phase, - bool is_ending, - bool should_propagate, - bool delta_consumed_for_scroll_sequence, - bool is_direct_manipulation) - : data_(delta_x, - delta_y, - start_position_x, - start_position_y, - velocity_x, - velocity_y, - is_beginning, - is_in_inertial_phase, - is_ending, - should_propagate, - delta_consumed_for_scroll_sequence, - is_direct_manipulation) {} - ScrollState::ScrollState(ScrollStateData data) : data_(data) {} ScrollState::~ScrollState() {}
diff --git a/cc/input/scroll_state.h b/cc/input/scroll_state.h index d704ecb..4d84fac3 100644 --- a/cc/input/scroll_state.h +++ b/cc/input/scroll_state.h
@@ -21,30 +21,6 @@ // here: https://goo.gl/1ipTpP. class CC_EXPORT ScrollState { public: - static scoped_ptr<ScrollState> Create(const gfx::Vector2dF& scroll_delta, - const gfx::Point& viewport_point, - const gfx::Vector2dF& scroll_velocity, - bool is_beginning, - bool is_in_inertial_phase, - bool is_ending) { - return make_scoped_ptr(new ScrollState( - scroll_delta.x(), scroll_delta.y(), viewport_point.x(), - viewport_point.y(), scroll_velocity.x(), scroll_velocity.y(), - is_beginning, is_in_inertial_phase, is_ending)); - } - - ScrollState(double delta_x, - double delta_y, - int start_position_x, - int start_position_y, - double velocity_x, - double velocity_y, - bool is_beginning, - bool is_in_inertial_phase, - bool is_ending, - bool should_propagate = false, - bool delta_consumed_for_scroll_sequence = false, - bool is_direct_manipulation = false); explicit ScrollState(ScrollStateData data); ~ScrollState(); @@ -89,11 +65,11 @@ } void set_current_native_scrolling_layer(LayerImpl* layer) { - data_.current_native_scrolling_layer = layer; + data_.set_current_native_scrolling_layer(layer); } LayerImpl* current_native_scrolling_layer() const { - return data_.current_native_scrolling_layer; + return data_.current_native_scrolling_layer(); } bool delta_consumed_for_scroll_sequence() const {
diff --git a/cc/input/scroll_state_data.cc b/cc/input/scroll_state_data.cc index 1eb1ceb..5d5e147 100644 --- a/cc/input/scroll_state_data.cc +++ b/cc/input/scroll_state_data.cc
@@ -4,48 +4,47 @@ #include "cc/input/scroll_state_data.h" +#include "cc/layers/layer_impl.h" + namespace cc { -ScrollStateData::ScrollStateData(double delta_x, - double delta_y, - int start_position_x, - int start_position_y, - double velocity_x, - double velocity_y, - bool is_beginning, - bool is_in_inertial_phase, - bool is_ending, - bool should_propagate, - bool delta_consumed_for_scroll_sequence, - bool is_direct_manipulation) - : delta_x(delta_x), - delta_y(delta_y), - start_position_x(start_position_x), - start_position_y(start_position_y), - velocity_x(velocity_x), - velocity_y(velocity_y), - is_beginning(is_beginning), - is_in_inertial_phase(is_in_inertial_phase), - is_ending(is_ending), - should_propagate(should_propagate), - current_native_scrolling_layer(nullptr), - delta_consumed_for_scroll_sequence(delta_consumed_for_scroll_sequence), - is_direct_manipulation(is_direct_manipulation), - caused_scroll_x(false), - caused_scroll_y(false) {} - ScrollStateData::ScrollStateData() - : ScrollStateData(0, - 0, - 0, - 0, - 0, - 0, - false, - false, - false, - true, - false, - false) {} + : delta_x(0), + delta_y(0), + start_position_x(0), + start_position_y(0), + velocity_x(0), + velocity_y(0), + is_beginning(false), + is_in_inertial_phase(false), + is_ending(false), + should_propagate(false), + from_user_input(false), + delta_consumed_for_scroll_sequence(false), + is_direct_manipulation(false), + delta_granularity(0), + caused_scroll_x(false), + caused_scroll_y(false), + current_native_scrolling_layer_(nullptr), + current_native_scrolling_element_(0) {} + +LayerImpl* ScrollStateData::current_native_scrolling_layer() const { + return current_native_scrolling_layer_; +} +void ScrollStateData::set_current_native_scrolling_layer( + LayerImpl* current_native_scrolling_layer) { + current_native_scrolling_layer_ = current_native_scrolling_layer; + current_native_scrolling_element_ = 0; +} +uint64_t ScrollStateData::current_native_scrolling_element() const { + if (current_native_scrolling_layer_) + return current_native_scrolling_layer_->element_id(); + return current_native_scrolling_element_; +} +void ScrollStateData::set_current_native_scrolling_element( + uint64_t element_id) { + current_native_scrolling_element_ = element_id; + current_native_scrolling_layer_ = nullptr; +} } // namespace cc
diff --git a/cc/input/scroll_state_data.h b/cc/input/scroll_state_data.h index 302970b..7608914 100644 --- a/cc/input/scroll_state_data.h +++ b/cc/input/scroll_state_data.h
@@ -5,6 +5,8 @@ #ifndef CC_INPUT_SCROLL_STATE_DATA_H_ #define CC_INPUT_SCROLL_STATE_DATA_H_ +#include <stdint.h> + #include <list> #include "cc/base/cc_export.h" @@ -13,21 +15,10 @@ class LayerImpl; -struct CC_EXPORT ScrollStateData { +class CC_EXPORT ScrollStateData { public: ScrollStateData(); - ScrollStateData(double delta_x, - double delta_y, - int start_position_x, - int start_position_y, - double velocity_x, - double velocity_y, - bool is_beginning, - bool is_in_inertial_phase, - bool is_ending, - bool should_propagate, - bool delta_consumed_for_scroll_sequence, - bool is_direct_manipulation); + // Scroll delta in viewport coordinates (DIP). double delta_x; double delta_y; @@ -43,15 +34,17 @@ bool is_ending; bool should_propagate; + bool from_user_input; - // The last layer to respond to a scroll, or null if none exists. - LayerImpl* current_native_scrolling_layer; // Whether the scroll sequence has had any delta consumed, in the // current frame, or any child frames. bool delta_consumed_for_scroll_sequence; // True if the user interacts directly with the display, e.g., via // touch. bool is_direct_manipulation; + // Minimum amount this input device can scroll. + double delta_granularity; + // TODO(tdresser): ScrollState shouldn't need to keep track of whether or not // this ScrollState object has caused a scroll. Ideally, any native scroller // consuming delta has caused a scroll. Currently, there are some cases where @@ -60,6 +53,23 @@ // of |caused_scroll_*_|. See crbug.com/510045 for details. bool caused_scroll_x; bool caused_scroll_y; + + LayerImpl* current_native_scrolling_layer() const; + void set_current_native_scrolling_layer( + LayerImpl* current_native_scrolling_layer); + uint64_t current_native_scrolling_element() const; + void set_current_native_scrolling_element(uint64_t element_id); + + private: + // Only one of current_native_scrolling_layer_ and + // current_native_scrolling_element_ may be non-null at a time. Whenever + // possible, we should store the layer. + + // The last layer to respond to a scroll, or null if none exists. + LayerImpl* current_native_scrolling_layer_; + // The id of the last native element to respond to a scroll, or 0 if none + // exists. + uint64_t current_native_scrolling_element_; }; } // namespace cc
diff --git a/cc/input/scroll_state_unittest.cc b/cc/input/scroll_state_unittest.cc index ccebeea2..452fbf9 100644 --- a/cc/input/scroll_state_unittest.cc +++ b/cc/input/scroll_state_unittest.cc
@@ -23,41 +23,42 @@ const float delta_x_to_consume = 1.2f; const float delta_y_to_consume = 2.3f; - ScrollState scrollState(delta_x, delta_y, 0, 0, false /* is_beginning */, - false /* is_inertial */, false /* is_ending */, - false /* should_propagate */, - false /* delta_consumed_for_scroll_sequence */, - false /* is_direct_manipulation */); - EXPECT_FLOAT_EQ(delta_x, scrollState.delta_x()); - EXPECT_FLOAT_EQ(delta_y, scrollState.delta_y()); - EXPECT_FALSE(scrollState.delta_consumed_for_scroll_sequence()); - EXPECT_FALSE(scrollState.FullyConsumed()); + ScrollStateData scroll_state_data; + scroll_state_data.delta_x = delta_x; + scroll_state_data.delta_y = delta_y; + ScrollState scroll_state(scroll_state_data); - scrollState.ConsumeDelta(0, 0); - EXPECT_FLOAT_EQ(delta_x, scrollState.delta_x()); - EXPECT_FLOAT_EQ(delta_y, scrollState.delta_y()); - EXPECT_FALSE(scrollState.delta_consumed_for_scroll_sequence()); - EXPECT_FALSE(scrollState.FullyConsumed()); + EXPECT_FLOAT_EQ(delta_x, scroll_state.delta_x()); + EXPECT_FLOAT_EQ(delta_y, scroll_state.delta_y()); + EXPECT_FALSE(scroll_state.delta_consumed_for_scroll_sequence()); + EXPECT_FALSE(scroll_state.FullyConsumed()); - scrollState.ConsumeDelta(delta_x_to_consume, 0); - EXPECT_FLOAT_EQ(delta_x - delta_x_to_consume, scrollState.delta_x()); - EXPECT_FLOAT_EQ(delta_y, scrollState.delta_y()); - EXPECT_TRUE(scrollState.delta_consumed_for_scroll_sequence()); - EXPECT_FALSE(scrollState.FullyConsumed()); + scroll_state.ConsumeDelta(0, 0); + EXPECT_FLOAT_EQ(delta_x, scroll_state.delta_x()); + EXPECT_FLOAT_EQ(delta_y, scroll_state.delta_y()); + EXPECT_FALSE(scroll_state.delta_consumed_for_scroll_sequence()); + EXPECT_FALSE(scroll_state.FullyConsumed()); - scrollState.ConsumeDelta(0, delta_y_to_consume); - EXPECT_FLOAT_EQ(delta_x - delta_x_to_consume, scrollState.delta_x()); - EXPECT_FLOAT_EQ(delta_y - delta_y_to_consume, scrollState.delta_y()); - EXPECT_TRUE(scrollState.delta_consumed_for_scroll_sequence()); - EXPECT_FALSE(scrollState.FullyConsumed()); + scroll_state.ConsumeDelta(delta_x_to_consume, 0); + EXPECT_FLOAT_EQ(delta_x - delta_x_to_consume, scroll_state.delta_x()); + EXPECT_FLOAT_EQ(delta_y, scroll_state.delta_y()); + EXPECT_TRUE(scroll_state.delta_consumed_for_scroll_sequence()); + EXPECT_FALSE(scroll_state.FullyConsumed()); - scrollState.ConsumeDelta(scrollState.delta_x(), scrollState.delta_y()); - EXPECT_TRUE(scrollState.delta_consumed_for_scroll_sequence()); - EXPECT_TRUE(scrollState.FullyConsumed()); + scroll_state.ConsumeDelta(0, delta_y_to_consume); + EXPECT_FLOAT_EQ(delta_x - delta_x_to_consume, scroll_state.delta_x()); + EXPECT_FLOAT_EQ(delta_y - delta_y_to_consume, scroll_state.delta_y()); + EXPECT_TRUE(scroll_state.delta_consumed_for_scroll_sequence()); + EXPECT_FALSE(scroll_state.FullyConsumed()); + + scroll_state.ConsumeDelta(scroll_state.delta_x(), scroll_state.delta_y()); + EXPECT_TRUE(scroll_state.delta_consumed_for_scroll_sequence()); + EXPECT_TRUE(scroll_state.FullyConsumed()); } TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) { - ScrollState scrollState(0, 0, 0, 0, false, false, false, false, false, false); + ScrollStateData scroll_state_data; + ScrollState scroll_state(scroll_state_data); FakeImplTaskRunnerProvider task_runner_provider; TestSharedBitmapManager shared_bitmap_manager; @@ -67,15 +68,18 @@ scoped_ptr<LayerImpl> layer_impl = LayerImpl::Create(host_impl.active_tree(), 1); - scrollState.set_current_native_scrolling_layer(layer_impl.get()); - EXPECT_EQ(layer_impl.get(), scrollState.current_native_scrolling_layer()); + scroll_state.set_current_native_scrolling_layer(layer_impl.get()); + EXPECT_EQ(layer_impl.get(), scroll_state.current_native_scrolling_layer()); } TEST_F(ScrollStateTest, FullyConsumed) { - ScrollState scrollState(1, 3, 0, 0, 0, false, false, false, false, false); - EXPECT_FALSE(scrollState.FullyConsumed()); + ScrollStateData scroll_state_data; + scroll_state_data.delta_x = 1; + scroll_state_data.delta_y = 3; + ScrollState scroll_state(scroll_state_data); - scrollState.ConsumeDelta(1, 3); - EXPECT_TRUE(scrollState.FullyConsumed()); + EXPECT_FALSE(scroll_state.FullyConsumed()); + scroll_state.ConsumeDelta(1, 3); + EXPECT_TRUE(scroll_state.FullyConsumed()); } } // namespace cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 28cd531..8c8c2051 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -2622,8 +2622,12 @@ return scroll_status; } - ScrollState scroll_state(0, 0, viewport_point.x(), viewport_point.y(), 0, 0, - false, true, false); + ScrollStateData scroll_state_data; + scroll_state_data.start_position_x = viewport_point.x(); + scroll_state_data.start_position_y = viewport_point.y(); + scroll_state_data.is_in_inertial_phase = true; + ScrollState scroll_state(scroll_state_data); + // ScrollAnimated is used for animated wheel scrolls. We find the first layer // that can scroll and set up an animation of its scroll offset. Note that // this does not currently go through the scroll customization and viewport @@ -3842,7 +3846,8 @@ void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { // TODO(majidvp): We should pass in the original starting scroll position here - ScrollState scroll_state(0, 0, 0, 0, 0, 0, false, false, false); + ScrollStateData scroll_state_data; + ScrollState scroll_state(scroll_state_data); ScrollEnd(&scroll_state); }
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index d67e6e3..3bd94be 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -390,19 +390,30 @@ } scoped_ptr<ScrollState> BeginState(const gfx::Point& point) { - return ScrollState::Create(gfx::Vector2dF(), point, gfx::Vector2dF(), true, - false, false); + ScrollStateData scroll_state_data; + scroll_state_data.is_beginning = true; + scroll_state_data.start_position_x = point.x(); + scroll_state_data.start_position_y = point.y(); + scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); + return scroll_state; } scoped_ptr<ScrollState> UpdateState(const gfx::Point& point, const gfx::Vector2dF& delta) { - return ScrollState::Create(delta, point, gfx::Vector2dF(), false, false, - false); + ScrollStateData scroll_state_data; + scroll_state_data.delta_x = delta.x(); + scroll_state_data.delta_y = delta.y(); + scroll_state_data.start_position_x = point.x(); + scroll_state_data.start_position_y = point.y(); + scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); + return scroll_state; } scoped_ptr<ScrollState> EndState() { - return ScrollState::Create(gfx::Vector2dF(), gfx::Point(), gfx::Vector2dF(), - false, false, true); + ScrollStateData scroll_state_data; + scroll_state_data.is_ending = true; + scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); + return scroll_state; } void DrawFrame() { @@ -9292,10 +9303,8 @@ UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get()); EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), InputHandler::WHEEL)); - ScrollState scroll_state_end(0, 0, 0 /* start_position_x */, - y + 50 /* start_position_y */, 0, 0, false, - false, true); - host_impl_->ScrollEnd(&scroll_state_end); + scoped_ptr<ScrollState> scroll_state_end = EndState(); + host_impl_->ScrollEnd(scroll_state_end.get()); EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), InputHandler::WHEEL));
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 0c49977..08269d7 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -30,19 +30,30 @@ namespace { scoped_ptr<ScrollState> BeginState(const gfx::Point& point) { - return ScrollState::Create(gfx::Vector2dF(), point, gfx::Vector2dF(), true, - false, false); + ScrollStateData scroll_state_data; + scroll_state_data.is_beginning = true; + scroll_state_data.start_position_x = point.x(); + scroll_state_data.start_position_y = point.y(); + scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); + return scroll_state; } scoped_ptr<ScrollState> UpdateState(const gfx::Point& point, const gfx::Vector2dF& delta) { - return ScrollState::Create(delta, point, gfx::Vector2dF(), false, false, - false); + ScrollStateData scroll_state_data; + scroll_state_data.delta_x = delta.x(); + scroll_state_data.delta_y = delta.y(); + scroll_state_data.start_position_x = point.x(); + scroll_state_data.start_position_y = point.y(); + scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); + return scroll_state; } scoped_ptr<ScrollState> EndState() { - return ScrollState::Create(gfx::Vector2dF(), gfx::Point(), gfx::Vector2dF(), - false, false, true); + ScrollStateData scroll_state_data; + scroll_state_data.is_ending = true; + scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); + return scroll_state; } class LayerTreeHostScrollTest : public LayerTreeTest {
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 46561da..53642e42 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -1860,7 +1860,8 @@ void LayerTreeImpl::InputScrollAnimationFinished() { // TODO(majidvp): We should pass in the original starting scroll position here - ScrollState scroll_state(0, 0, 0, 0, 0, 0, false, false, false); + ScrollStateData scroll_state_data; + ScrollState scroll_state(scroll_state_data); layer_tree_host_impl_->ScrollEnd(&scroll_state); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java index d7fb83c..739bf2c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -26,6 +26,7 @@ import org.chromium.base.ApplicationStatus.ApplicationStateListener; import org.chromium.base.BuildInfo; import org.chromium.base.CommandLineInitUtil; +import org.chromium.base.PathUtils; import org.chromium.base.ResourceExtractor; import org.chromium.base.ThreadUtils; import org.chromium.base.TraceEvent; @@ -121,6 +122,7 @@ private static final long BOOT_TIMESTAMP_MARGIN_MS = 1000; private static final String PREF_LOCALE = "locale"; private static final float FLOAT_EPSILON = 0.001f; + private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome"; private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions.id"; @@ -424,6 +426,7 @@ if (!BuildInfo.hasLanguageApkSplits(this)) { ResourceExtractor.setResourcesToExtract(ResourceBundle.getActiveLocaleResources()); } + PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, this); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java deleted file mode 100644 index 5b76829..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java +++ /dev/null
@@ -1,60 +0,0 @@ -// Copyright 2015 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. - -package org.chromium.chrome.browser.infobar; - -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.ClickableSpan; -import android.view.View; - -import org.chromium.base.annotations.CalledByNative; -import org.chromium.chrome.R; - -/** - * The auto sign-in first run experience infobar is shown instead of usual auto sign-in snackbar - * when user first time faces the auto sign-in feature. It contains information about which account - * was used for signing in and text which explains the feature. - */ -public class AutoSigninFirstRunInfoBar extends ConfirmInfoBar { - private final String mExplanation; - private final int mExplanationLinkStart; - private final int mExplanationLinkEnd; - - @CalledByNative - private static InfoBar show(String message, String primaryButtonText, String explanation, - int explanationLinkStart, int explanationLinkEnd) { - return new AutoSigninFirstRunInfoBar( - message, primaryButtonText, explanation, explanationLinkStart, explanationLinkEnd); - } - - private AutoSigninFirstRunInfoBar(String message, String primaryButtonText, String explanation, - int explanationLinkStart, int explanationLinkEnd) { - super(R.drawable.account_management_no_picture, null, message, null, - primaryButtonText, null); - mExplanation = explanation; - mExplanationLinkStart = explanationLinkStart; - mExplanationLinkEnd = explanationLinkEnd; - } - - /** - * Adds text, which explains the auto sign-in feature. - */ - @Override - public void createContent(InfoBarLayout layout) { - super.createContent(layout); - SpannableString explanation = new SpannableString(mExplanation); - if (mExplanationLinkEnd != mExplanationLinkStart && mExplanationLinkEnd != 0) { - explanation.setSpan(new ClickableSpan() { - @Override - public void onClick(View view) { - onLinkClicked(); - } - }, mExplanationLinkStart, mExplanationLinkEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - } - - InfoBarControlLayout controlLayout = layout.addControlLayout(); - controlLayout.addDescription(explanation); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java index aa9e317..9352f016 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -20,7 +20,6 @@ import org.chromium.base.CommandLine; import org.chromium.base.ContentUriUtils; import org.chromium.base.Log; -import org.chromium.base.PathUtils; import org.chromium.base.ResourceExtractor; import org.chromium.base.ThreadUtils; import org.chromium.base.TraceEvent; @@ -56,7 +55,6 @@ */ public class ChromeBrowserInitializer { private static final String TAG = "BrowserInitializer"; - private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; private static ChromeBrowserInitializer sChromeBrowserInitiliazer; private final Handler mHandler; @@ -120,8 +118,6 @@ public void handlePreNativeStartup(final BrowserParts parts) { assert ThreadUtils.runningOnUiThread() : "Tried to start the browser on the wrong thread"; - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, mApplication); - preInflationStartup(); parts.preInflationStartup(); preInflationStartupDone();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSession.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSession.java index 3abc122a..a45554fb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSession.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSession.java
@@ -512,7 +512,7 @@ messageType = sMediaOverloadedMessageTypes.get(messageType); jsonCastMessage.put("type", messageType); } - return sendCastMessage(jsonCastMessage, MEDIA_NAMESPACE, clientId, sequenceNumber); + return sendJsonCastMessage(jsonCastMessage, MEDIA_NAMESPACE, clientId, sequenceNumber); } return true; @@ -613,9 +613,6 @@ JSONObject jsonAppMessageWrapper = jsonMessage.getJSONObject("message"); - JSONObject actualMessage = jsonAppMessageWrapper.getJSONObject("message"); - if (actualMessage == null) return false; - if (!mSessionId.equals(jsonAppMessageWrapper.getString("sessionId"))) return false; String namespaceName = jsonAppMessageWrapper.getString("namespaceName"); @@ -624,10 +621,20 @@ if (!mNamespaces.contains(namespaceName)) return false; int sequenceNumber = jsonMessage.optInt("sequenceNumber", INVALID_SEQUENCE_NUMBER); - return sendCastMessage(actualMessage, namespaceName, clientId, sequenceNumber); + + Object actualMessageObject = jsonAppMessageWrapper.get("message"); + if (actualMessageObject == null) return false; + + if (actualMessageObject instanceof String) { + String actualMessage = jsonAppMessageWrapper.getString("message"); + return sendStringCastMessage(actualMessage, namespaceName, clientId, sequenceNumber); + } + + JSONObject actualMessage = jsonAppMessageWrapper.getJSONObject("message"); + return sendJsonCastMessage(actualMessage, namespaceName, clientId, sequenceNumber); } - private boolean sendCastMessage( + private boolean sendJsonCastMessage( JSONObject message, final String namespace, final String clientId, @@ -649,10 +656,18 @@ mRequests.append(requestId, new RequestRecord(clientId, sequenceNumber)); } + return sendStringCastMessage(message.toString(), namespace, clientId, sequenceNumber); + } + + private boolean sendStringCastMessage( + final String message, + final String namespace, + final String clientId, + final int sequenceNumber) { Log.d(TAG, "Sending message to Cast device in namespace %s: %s", namespace, message); try { - Cast.CastApi.sendMessage(mApiClient, namespace, message.toString()) + Cast.CastApi.sendMessage(mApiClient, namespace, message) .setResultCallback( new ResultCallback<Status>() { @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java index b9fc49c..1ce836f8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
@@ -587,8 +587,12 @@ mNotificationBuilder.setOngoing(!mMediaNotificationInfo.isPaused); } - mNotificationBuilder.setContentIntent( - PendingIntent.getActivity(mContext, 0, mMediaNotificationInfo.contentIntent, 0)); + // The intent will currently only be null when using a custom tab. + // TODO(avayvod) work out what we should do in this case. See https://crbug.com/585395. + if (mMediaNotificationInfo.contentIntent != null) { + mNotificationBuilder.setContentIntent(PendingIntent.getActivity(mContext, 0, + mMediaNotificationInfo.contentIntent, 0)); + } mNotificationBuilder.setContent(createContentView()); mNotificationBuilder.setVisibility(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/ClearSyncDataPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/ClearSyncDataPreferences.java index b75983f..a55fcb4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/ClearSyncDataPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/ClearSyncDataPreferences.java
@@ -26,6 +26,7 @@ } @Override + @SuppressWarnings("deprecation") public void onAttach(Activity activity) { super.onAttach(activity); mApplicationContext = activity.getApplicationContext();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java index 405063d..e5587f3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java
@@ -16,7 +16,6 @@ import android.view.MotionEvent.PointerProperties; import android.widget.FrameLayout; -import org.chromium.base.PathUtils; import org.chromium.base.ThreadUtils; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; @@ -46,8 +45,6 @@ implements MockTabModelDelegate { private static final String TAG = "LayoutManagerTest"; - private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content"; - private long mLastDownTime = 0; private TabModelSelector mTabModelSelector; @@ -468,9 +465,6 @@ protected void setUp() throws Exception { super.setUp(); - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, - getInstrumentation().getTargetContext()); - // Load the browser process. ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index 9da48f09..00512bd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -25,6 +25,7 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; @@ -200,21 +201,6 @@ } /** - * Waits for the requested search term to match, and asserts. - * @param searchTerm A given search term. - */ - public void waitForSearchTermToMatch( - final String searchTerm) throws InterruptedException { - CriteriaHelper.pollForCriteria(new Criteria("Search term never matched.") { - @Override - public boolean isSatisfied() { - String url = mFakeServer.getLoadedUrl(); - return !TextUtils.isEmpty(url) && url.contains("q=" + searchTerm); - } - }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL); - } - - /** * Runs the given Runnable in the main thread. * @param runnable The Runnable. */ @@ -256,7 +242,7 @@ private void simulateTapSearch(String nodeId) throws InterruptedException, TimeoutException { ContextualSearchFakeServer.FakeTapSearch search = mFakeServer.getFakeTapSearch(nodeId); search.simulate(); - waitForSearchTermToMatch(search.getSearchTerm()); + assertLoadedSearchTermMatches(search.getSearchTerm()); waitForPanelToPeek(); } @@ -497,8 +483,7 @@ boolean doesMatch = false; String message = "but there was no loaded URL!"; if (mFakeServer != null) { - String url = mFakeServer.getLoadedUrl(); - doesMatch = !TextUtils.isEmpty(url) && url.contains("q=" + searchTerm); + doesMatch = mFakeServer.getLoadedUrl().contains("q=" + searchTerm); message = "in URL: " + mFakeServer.getLoadedUrl(); } assertTrue("Expected to find searchTerm " + searchTerm + ", " + message, doesMatch); @@ -2302,6 +2287,7 @@ /** * Tests that chained searches load correctly. */ + @DisabledTest // https://crbug.com/551711 @SmallTest @Feature({"ContextualSearch"}) @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java index b38b4eb93..a4ba878d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java
@@ -13,7 +13,6 @@ import android.test.UiThreadTest; import android.test.suitebuilder.annotation.SmallTest; -import org.chromium.base.PathUtils; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; import org.chromium.base.test.util.Feature; @@ -29,15 +28,10 @@ private static final String SEARCH_URL_1 = "https://www.google.com/search?q=potatoes"; private static final String SEARCH_URL_2 = "https://www.google.co.jp/webhp?#q=dinosaurs"; - private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content"; - @SmallTest @Feature({"Location"}) @UiThreadTest public void testGeolocationHeader() throws ProcessInitException { - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, - getInstrumentation().getTargetContext()); - Context targetContext = getInstrumentation().getTargetContext(); BrowserStartupController.get(targetContext, LibraryProcessType.PROCESS_BROWSER) .startBrowserProcessesSync(false);
diff --git a/chrome/app/nibs/MainMenu.xib b/chrome/app/nibs/MainMenu.xib index b66bab71..7b858537 100644 --- a/chrome/app/nibs/MainMenu.xib +++ b/chrome/app/nibs/MainMenu.xib
@@ -492,6 +492,11 @@ <action selector="commandDispatch:" target="-1" id="530"/> </connections> </menuItem> + <menuItem title="^IDS_SHOW_AS_TAB" tag="34029" id="470"> + <connections> + <action selector="commandDispatch:" target="-1" id="559"/> + </connections> + </menuItem> <menuItem isSeparatorItem="YES" id="551"/> <menuItem title="^IDS_SHOW_DOWNLOADS_MAC" tag="40012" keyEquivalent="J" id="550"> <connections>
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc index 526481f2..991ea4d3 100644 --- a/chrome/browser/android/chrome_jni_registrar.cc +++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -134,7 +134,6 @@ #include "chrome/browser/ui/android/connection_info_popup_android.h" #include "chrome/browser/ui/android/context_menu_helper.h" #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" -#include "chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h" #include "chrome/browser/ui/android/infobars/autofill_save_card_infobar.h" #include "chrome/browser/ui/android/infobars/confirm_infobar.h" #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h" @@ -337,7 +336,6 @@ remote_media::RemoteMediaPlayerBridge::RegisterRemoteMediaPlayerBridge}, {"RevenueStats", RegisterRevenueStats}, {"SavePasswordInfoBar", SavePasswordInfoBar::Register}, - {"AutoSigninFirstRunInfoBar", AutoSigninFirstRunInfoBar::Register}, {"SceneLayer", chrome::android::RegisterSceneLayer}, {"ScreenshotTask", RegisterScreenshotTask}, {"ServiceTabLauncher", service_tab_launcher::RegisterServiceTabLauncherJni},
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index d9eceb7..e33ff8e 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm
@@ -982,6 +982,16 @@ ![self keyWindowIsModal] : NO; } } + + // "Show as tab" should only appear when the current window is a popup. + // Since |validateUserInterfaceItem:| is called only when there are no + // key windows, we should just hide this. + // This is handled outside of the switch statement because we want to hide + // this regardless if the command is supported or not. + if (tag == IDC_SHOW_AS_TAB) { + NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); + [menuItem setHidden:YES]; + } } else if (action == @selector(terminate:)) { enable = YES; } else if (action == @selector(showPreferences:)) {
diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc index f67ee39..883ca01 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/notifications/message_center_settings_controller.h" #include <algorithm> +#include <string> #include <utility> #include "base/command_line.h" @@ -22,6 +23,8 @@ #include "chrome/browser/notifications/notifier_state_tracker.h" #include "chrome/browser/notifications/notifier_state_tracker_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_attributes_entry.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/extensions/api/notifications.h" @@ -59,12 +62,10 @@ ProfileNotifierGroup(const gfx::Image& icon, const base::string16& display_name, const base::string16& login_info, - size_t index, const base::FilePath& profile_path); ProfileNotifierGroup(const gfx::Image& icon, const base::string16& display_name, const base::string16& login_info, - size_t index, Profile* profile); virtual ~ProfileNotifierGroup() {} @@ -77,9 +78,8 @@ ProfileNotifierGroup::ProfileNotifierGroup(const gfx::Image& icon, const base::string16& display_name, const base::string16& login_info, - size_t index, const base::FilePath& profile_path) - : message_center::NotifierGroup(icon, display_name, login_info, index), + : message_center::NotifierGroup(icon, display_name, login_info), profile_(NULL) { // Try to get the profile profile_ = @@ -89,9 +89,8 @@ ProfileNotifierGroup::ProfileNotifierGroup(const gfx::Image& icon, const base::string16& display_name, const base::string16& login_info, - size_t index, Profile* profile) - : message_center::NotifierGroup(icon, display_name, login_info, index), + : message_center::NotifierGroup(icon, display_name, login_info), profile_(profile) { } @@ -120,11 +119,10 @@ } // namespace MessageCenterSettingsController::MessageCenterSettingsController( - ProfileInfoCache* profile_info_cache) + ProfileAttributesStorage& storage) : current_notifier_group_(0), - profile_info_cache_(profile_info_cache), + storage_(storage), weak_factory_(this) { - DCHECK(profile_info_cache_); // The following events all represent changes that may need to be reflected in // the profile selector context menu, so listen for them all. We'll just // rebuild the list when we get any of them. @@ -137,7 +135,7 @@ registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, content::NotificationService::AllBrowserContextsAndSources()); - g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this); + storage_.AddObserver(this); RebuildNotifierGroups(false); #if defined(OS_CHROMEOS) @@ -148,8 +146,7 @@ } MessageCenterSettingsController::~MessageCenterSettingsController() { - g_browser_process->profile_manager()-> - GetProfileInfoCache().RemoveObserver(this); + storage_.RemoveObserver(this); #if defined(OS_CHROMEOS) // UserManager may not exist in some tests. if (user_manager::UserManager::IsInitialized()) @@ -492,7 +489,6 @@ new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), user->GetDisplayName(), user->GetDisplayName(), - 0, profile)); notifier_groups_.push_back(std::move(group)); @@ -507,15 +503,15 @@ notifier_groups_.clear(); current_notifier_group_ = 0; - const size_t count = profile_info_cache_->GetNumberOfProfiles(); - for (size_t i = 0; i < count; ++i) { + std::vector<ProfileAttributesEntry*> entries = + storage_.GetAllProfilesAttributes(); + for (const auto entry : entries) { scoped_ptr<message_center::ProfileNotifierGroup> group( new message_center::ProfileNotifierGroup( - profile_info_cache_->GetAvatarIconOfProfileAtIndex(i), - profile_info_cache_->GetNameOfProfileAtIndex(i), - profile_info_cache_->GetUserNameOfProfileAtIndex(i), - i, - profile_info_cache_->GetPathOfProfileAtIndex(i))); + entry->GetAvatarIcon(), + entry->GetName(), + entry->GetUserName(), + entry->GetPath())); if (group->profile() == NULL) continue;
diff --git a/chrome/browser/notifications/message_center_settings_controller.h b/chrome/browser/notifications/message_center_settings_controller.h index 0b5fc97..1c1403a 100644 --- a/chrome/browser/notifications/message_center_settings_controller.h +++ b/chrome/browser/notifications/message_center_settings_controller.h
@@ -16,7 +16,7 @@ #include "base/observer_list.h" #include "build/build_config.h" #include "chrome/browser/extensions/app_icon_loader.h" -#include "chrome/browser/profiles/profile_info_cache_observer.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" #include "components/content_settings/core/common/content_settings.h" #include "components/favicon_base/favicon_types.h" #include "content/public/browser/notification_details.h" @@ -30,7 +30,6 @@ #endif class Profile; -class ProfileInfoCache; namespace base { class CancelableTaskTracker; @@ -49,14 +48,13 @@ class MessageCenterSettingsController : public message_center::NotifierSettingsProvider, public content::NotificationObserver, - public ProfileInfoCacheObserver, + public ProfileAttributesStorage::Observer, #if defined(OS_CHROMEOS) public user_manager::UserManager::UserSessionStateObserver, #endif public extensions::AppIconLoader::Delegate { public: - explicit MessageCenterSettingsController( - ProfileInfoCache* profile_info_cache); + explicit MessageCenterSettingsController(ProfileAttributesStorage& storage); ~MessageCenterSettingsController() override; // Overridden from message_center::NotifierSettingsProvider. @@ -94,7 +92,7 @@ const content::NotificationSource& source, const content::NotificationDetails& details) override; - // ProfileInfoCacheObserver: + // ProfileAttributesStorage::Observer: void OnProfileAdded(const base::FilePath& profile_path) override; void OnProfileWasRemoved(const base::FilePath& profile_path, const base::string16& profile_name) override; @@ -128,7 +126,8 @@ std::map<base::string16, ContentSettingsPattern> patterns_; // The list of all configurable notifier groups. This is each profile that is - // loaded (and in the ProfileInfoCache - so no incognito profiles go here). + // loaded (and in the ProfileAttributesStorage - so no incognito profiles go + // here). std::vector<scoped_ptr<message_center::ProfileNotifierGroup>> notifier_groups_; @@ -136,7 +135,7 @@ content::NotificationRegistrar registrar_; - ProfileInfoCache* profile_info_cache_; + ProfileAttributesStorage& storage_; base::WeakPtrFactory<MessageCenterSettingsController> weak_factory_;
diff --git a/chrome/browser/notifications/message_center_settings_controller_unittest.cc b/chrome/browser/notifications/message_center_settings_controller_unittest.cc index f4b05b6..538c8455 100644 --- a/chrome/browser/notifications/message_center_settings_controller_unittest.cc +++ b/chrome/browser/notifications/message_center_settings_controller_unittest.cc
@@ -51,7 +51,7 @@ void CreateController() { controller_.reset(new MessageCenterSettingsController( - testing_profile_manager_.profile_info_cache())); + *testing_profile_manager_.profile_attributes_storage())); } void ResetController() { @@ -131,20 +131,15 @@ EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, base::UTF8ToUTF16("Profile-1")); - EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); - EXPECT_EQ(controller()->GetNotifierGroupAt(1).name, base::UTF8ToUTF16("Profile-2")); - EXPECT_EQ(controller()->GetNotifierGroupAt(1).index, 1u); EXPECT_EQ(controller()->GetActiveNotifierGroup().name, base::UTF8ToUTF16("Profile-1")); - EXPECT_EQ(controller()->GetActiveNotifierGroup().index, 0u); controller()->SwitchToNotifierGroup(1); EXPECT_EQ(controller()->GetActiveNotifierGroup().name, base::UTF8ToUTF16("Profile-2")); - EXPECT_EQ(controller()->GetActiveNotifierGroup().index, 1u); controller()->SwitchToNotifierGroup(0); EXPECT_EQ(controller()->GetActiveNotifierGroup().name, @@ -160,19 +155,16 @@ EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, base::UTF8ToUTF16("Profile-1")); - EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); SwitchActiveUser("Profile-2"); EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, base::UTF8ToUTF16("Profile-2")); - EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 1u); SwitchActiveUser("Profile-1"); EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, base::UTF8ToUTF16("Profile-1")); - EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); } // TODO(mukai): write a test case to reproduce the actual guest session scenario // in ChromeOS -- no profiles in the profile_info_cache.
diff --git a/chrome/browser/notifications/notification_ui_manager_desktop.cc b/chrome/browser/notifications/notification_ui_manager_desktop.cc index c03f4be..7de03bb5 100644 --- a/chrome/browser/notifications/notification_ui_manager_desktop.cc +++ b/chrome/browser/notifications/notification_ui_manager_desktop.cc
@@ -11,7 +11,6 @@ #include "chrome/browser/notifications/message_center_notification_manager.h" #include "chrome/browser/notifications/message_center_settings_controller.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" // static @@ -20,10 +19,9 @@ if (!profile_manager) return nullptr; - ProfileInfoCache* profile_info_cache = - &profile_manager->GetProfileInfoCache(); scoped_ptr<message_center::NotifierSettingsProvider> settings_provider( - new MessageCenterSettingsController(profile_info_cache)); + new MessageCenterSettingsController( + profile_manager->GetProfileAttributesStorage())); return new MessageCenterNotificationManager( g_browser_process->message_center(), std::move(settings_provider));
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc index 4ecaf15..5db0d1c 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -63,6 +63,8 @@ using content::PlatformNotificationContext; using message_center::NotifierId; +class ProfileAttributesEntry; + namespace { // Invalid id for a renderer process. Used in cases where we need to check for @@ -163,11 +165,11 @@ // if it already exist. We therefore check first that the profile is there // and fail early otherwise. const base::FilePath profile_path = - profile_manager->GetProfileInfoCache().GetUserDataDir().AppendASCII( - profile_id); + profile_manager->user_data_dir().AppendASCII(profile_id); - if (profile_manager->GetProfileInfoCache().GetIndexOfProfileWithPath( - profile_path) == std::string::npos) { + ProfileAttributesEntry* entry = nullptr; + if (!profile_manager->GetProfileAttributesStorage(). + GetProfileAttributesWithPath(profile_path, &entry)) { LOG(ERROR) << "Loading a path that does not exist"; return; }
diff --git a/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.cc b/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.cc deleted file mode 100644 index fe6e8d6f..0000000 --- a/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.cc +++ /dev/null
@@ -1,70 +0,0 @@ -// Copyright 2015 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. - -#include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h" - -#include "chrome/browser/infobars/infobar_service.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/profile_sync_service_factory.h" -#include "chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h" -#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" -#include "chrome/grit/chromium_strings.h" -#include "chrome/grit/generated_resources.h" -#include "components/browser_sync/browser/profile_sync_service.h" -#include "components/infobars/core/infobar.h" -#include "components/password_manager/core/browser/password_bubble_experiment.h" -#include "content/public/browser/web_contents.h" -#include "ui/base/l10n/l10n_util.h" - -// static -void AutoSigninFirstRunInfoBarDelegate::Create( - content::WebContents* web_contents, - const base::string16& message) { - Profile* profile = - Profile::FromBrowserContext(web_contents->GetBrowserContext()); - bool is_smartlock_branding_enabled = - password_bubble_experiment::IsSmartLockBrandingEnabled( - ProfileSyncServiceFactory::GetForProfile(profile)); - InfoBarService::FromWebContents(web_contents) - ->AddInfoBar(make_scoped_ptr(new AutoSigninFirstRunInfoBar( - make_scoped_ptr(new AutoSigninFirstRunInfoBarDelegate( - web_contents, is_smartlock_branding_enabled, message))))); -} - -AutoSigninFirstRunInfoBarDelegate::AutoSigninFirstRunInfoBarDelegate( - content::WebContents* web_contents, - bool is_smartlock_branding_enabled, - const base::string16& message) - : PasswordManagerInfoBarDelegate(), web_contents_(web_contents) { - gfx::Range explanation_link_range; - GetAutoSigninPromptFirstRunExperienceExplanation( - is_smartlock_branding_enabled, &explanation_, &explanation_link_range); - SetMessageLinkRange(explanation_link_range); - SetMessage(message); -} - -AutoSigninFirstRunInfoBarDelegate::~AutoSigninFirstRunInfoBarDelegate() { - Profile* profile = - Profile::FromBrowserContext(web_contents_->GetBrowserContext()); - password_bubble_experiment::RecordAutoSignInPromptFirstRunExperienceWasShown( - profile->GetPrefs()); -} - -infobars::InfoBarDelegate::InfoBarIdentifier -AutoSigninFirstRunInfoBarDelegate::GetIdentifier() const { - return AUTO_SIGNIN_FIRST_RUN_INFOBAR_DELEGATE; -} - -base::string16 AutoSigninFirstRunInfoBarDelegate::GetButtonLabel( - InfoBarButton button) const { - return l10n_util::GetStringUTF16(IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON); -} - -bool AutoSigninFirstRunInfoBarDelegate::Accept() { - return true; -} - -bool AutoSigninFirstRunInfoBarDelegate::Cancel() { - return true; -}
diff --git a/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h b/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h deleted file mode 100644 index 8fba5c4e..0000000 --- a/chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2015 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 CHROME_BROWSER_PASSWORD_MANAGER_AUTO_SIGNIN_FIRST_RUN_INFOBAR_DELEGATE_H_ -#define CHROME_BROWSER_PASSWORD_MANAGER_AUTO_SIGNIN_FIRST_RUN_INFOBAR_DELEGATE_H_ - -#include "base/macros.h" -#include "chrome/browser/password_manager/password_manager_infobar_delegate.h" - -namespace content { -class WebContents; -} - -// This delegate provides and acts on data for the android only auto sign-in -// first run experience infobar. -class AutoSigninFirstRunInfoBarDelegate - : public PasswordManagerInfoBarDelegate { - public: - static void Create(content::WebContents* web_contents, - const base::string16& message); - - ~AutoSigninFirstRunInfoBarDelegate() override; - - infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; - base::string16 GetButtonLabel(InfoBarButton button) const override; - bool Accept() override; - bool Cancel() override; - - base::string16 GetExplanation() { return explanation_; } - - protected: - // Makes a ctor available in tests. - AutoSigninFirstRunInfoBarDelegate(content::WebContents* web_contents, - bool is_smart_lock_branding_available, - const base::string16& message); - - private: - base::string16 explanation_; - - content::WebContents* web_contents_; - - DISALLOW_COPY_AND_ASSIGN(AutoSigninFirstRunInfoBarDelegate); -}; - -#endif // CHROME_BROWSER_PASSWORD_MANAGER_AUTO_SIGNIN_FIRST_RUN_INFOBAR_DELEGATE_H_
diff --git a/chrome/browser/password_manager/auto_signin_infobar_delegate_unittest.cc b/chrome/browser/password_manager/auto_signin_infobar_delegate_unittest.cc deleted file mode 100644 index fca6a1a28d..0000000 --- a/chrome/browser/password_manager/auto_signin_infobar_delegate_unittest.cc +++ /dev/null
@@ -1,80 +0,0 @@ -// Copyright 2015 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. - -#include "base/macros.h" -#include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/test/base/chrome_render_view_host_test_harness.h" -#include "components/password_manager/core/common/password_manager_pref_names.h" -#include "components/prefs/pref_service.h" -#include "content/public/browser/web_contents.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -class TestAutoSigninFirstRunInfoBarDelegate - : public AutoSigninFirstRunInfoBarDelegate { - public: - explicit TestAutoSigninFirstRunInfoBarDelegate( - content::WebContents* web_contents) - : AutoSigninFirstRunInfoBarDelegate( - web_contents, - true /* is_smartlock_branding_enabled */, - base::string16()) {} - - ~TestAutoSigninFirstRunInfoBarDelegate() override {} -}; - -} // namespace - -class AutoSigninFirstRunInfoBarDelegateTest - : public ChromeRenderViewHostTestHarness { - public: - AutoSigninFirstRunInfoBarDelegateTest() {} - ~AutoSigninFirstRunInfoBarDelegateTest() override {} - - PrefService* prefs(); - - protected: - scoped_ptr<ConfirmInfoBarDelegate> CreateDelegate(); - - private: - DISALLOW_COPY_AND_ASSIGN(AutoSigninFirstRunInfoBarDelegateTest); -}; - -scoped_ptr<ConfirmInfoBarDelegate> -AutoSigninFirstRunInfoBarDelegateTest::CreateDelegate() { - scoped_ptr<ConfirmInfoBarDelegate> delegate( - new TestAutoSigninFirstRunInfoBarDelegate(web_contents())); - return delegate; -} - -PrefService* AutoSigninFirstRunInfoBarDelegateTest::prefs() { - Profile* profile = - Profile::FromBrowserContext(web_contents()->GetBrowserContext()); - return profile->GetPrefs(); -} - -TEST_F(AutoSigninFirstRunInfoBarDelegateTest, - CheckResetOfPrefAfterFirstRunMessageWasShownOnCancel) { - prefs()->SetBoolean( - password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false); - scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate()); - EXPECT_TRUE(infobar->Cancel()); - infobar.reset(); - EXPECT_TRUE(prefs()->GetBoolean( - password_manager::prefs::kWasAutoSignInFirstRunExperienceShown)); -} - -TEST_F(AutoSigninFirstRunInfoBarDelegateTest, - CheckResetOfPrefAfterFirstRunMessageWasShownOnAccept) { - prefs()->SetBoolean( - password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false); - scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate()); - EXPECT_TRUE(infobar->Accept()); - infobar.reset(); - EXPECT_TRUE(prefs()->GetBoolean( - password_manager::prefs::kWasAutoSignInFirstRunExperienceShown)); -}
diff --git a/chrome/browser/profiles/profile_attributes_storage.h b/chrome/browser/profiles/profile_attributes_storage.h index 67b82af8..be37714 100644 --- a/chrome/browser/profiles/profile_attributes_storage.h +++ b/chrome/browser/profiles/profile_attributes_storage.h
@@ -7,12 +7,22 @@ #include <stddef.h> -#include "base/macros.h" +#include <string> +#include <vector> +#include "base/macros.h" +#include "base/strings/string16.h" +#include "chrome/browser/profiles/profile_info_cache_observer.h" + +namespace base { +class FilePath; +} // namespace base class ProfileAttributesEntry; class ProfileAttributesStorage { public: + using Observer = ProfileInfoCacheObserver; + ProfileAttributesStorage() {} ~ProfileAttributesStorage() {} @@ -46,6 +56,10 @@ // Returns the count of known profiles. virtual size_t GetNumberOfProfiles() const = 0; + virtual void AddObserver(ProfileAttributesStorage::Observer* observer) = 0; + virtual void RemoveObserver(ProfileAttributesStorage::Observer* observer) = 0; + + private: DISALLOW_COPY_AND_ASSIGN(ProfileAttributesStorage); };
diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h index a8137c8..7fffcf8 100644 --- a/chrome/browser/profiles/profile_info_cache.h +++ b/chrome/browser/profiles/profile_info_cache.h
@@ -182,8 +182,8 @@ const base::FilePath& image_path, const base::FilePath& profile_path); - void AddObserver(ProfileInfoCacheObserver* obs); - void RemoveObserver(ProfileInfoCacheObserver* obs); + void AddObserver(ProfileInfoCacheObserver* obs) override; + void RemoveObserver(ProfileInfoCacheObserver* obs) override; void set_disable_avatar_download_for_testing( bool disable_avatar_download_for_testing) {
diff --git a/chrome/browser/resources/options/language_list.js b/chrome/browser/resources/options/language_list.js index 1030a0a..24467e0a 100644 --- a/chrome/browser/resources/options/language_list.js +++ b/chrome/browser/resources/options/language_list.js
@@ -389,13 +389,12 @@ */ load_: function(languageCodes) { // Preserve the original selected index. See comments below. - var originalSelectedIndex = (this.selectionModel ? - this.selectionModel.selectedIndex : -1); + var originalSelectedIndex = this.selectionModel.selectedIndex; this.dataModel = new ArrayDataModel(languageCodes); if (originalSelectedIndex >= 0 && originalSelectedIndex < this.dataModel.length) { // Restore the original selected index if the selected index is - // valid after the data model is loaded. This is neeeded to keep + // valid after the data model is loaded. This is needed to keep // the selected language after the languge is added or removed. this.selectionModel.selectedIndex = originalSelectedIndex; // The lead index should be updated too.
diff --git a/chrome/browser/speech/extension_api/tts_extension_apitest.cc b/chrome/browser/speech/extension_api/tts_extension_apitest.cc index f913112..9424d5e4 100644 --- a/chrome/browser/speech/extension_api/tts_extension_apitest.cc +++ b/chrome/browser/speech/extension_api/tts_extension_apitest.cc
@@ -23,11 +23,8 @@ #include "extensions/browser/extension_system.h" #include "net/base/network_change_notifier.h" #include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -// Needed for CreateFunctor. -#define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING #include "testing/gmock_mutant.h" +#include "testing/gtest/include/gtest/gtest.h" using ::testing::AnyNumber; using ::testing::CreateFunctor; @@ -317,8 +314,8 @@ EXPECT_CALL(mock_platform_impl_, Speak(_, "first try", _, _, _)) .WillOnce(DoAll( InvokeWithoutArgs( - CreateFunctor(&mock_platform_impl_, - &MockTtsPlatformImpl::SetErrorToEpicFail)), + CreateFunctor(&MockTtsPlatformImpl::SetErrorToEpicFail, + base::Unretained(&mock_platform_impl_))), Return(false))); EXPECT_CALL(mock_platform_impl_, StopSpeaking()) .WillOnce(Return(true));
diff --git a/chrome/browser/spellchecker/feedback.cc b/chrome/browser/spellchecker/feedback.cc index 17bc4b7..cfc4a711 100644 --- a/chrome/browser/spellchecker/feedback.cc +++ b/chrome/browser/spellchecker/feedback.cc
@@ -35,7 +35,7 @@ Misspelling* Feedback::GetMisspelling(uint32_t hash) { HashMisspellingMap::iterator misspelling_it = misspellings_.find(hash); if (misspelling_it == misspellings_.end()) - return NULL; + return nullptr; return &misspelling_it->second; } @@ -49,12 +49,11 @@ HashCollection& renderer_hashes = renderer_it->second; HashCollection remaining_hashes(remaining_markers.begin(), remaining_markers.end()); - std::vector<uint32_t> removed_hashes = - base::STLSetDifference<std::vector<uint32_t>>(renderer_hashes, - remaining_hashes); - for (std::vector<uint32_t>::const_iterator hash_it = removed_hashes.begin(); - hash_it != removed_hashes.end(); ++hash_it) { - HashMisspellingMap::iterator misspelling_it = misspellings_.find(*hash_it); + std::vector<HashCollection::value_type> removed_hashes = + base::STLSetDifference<std::vector<HashCollection::value_type>>( + renderer_hashes, remaining_hashes); + for (auto hash : removed_hashes) { + HashMisspellingMap::iterator misspelling_it = misspellings_.find(hash); if (misspelling_it != misspellings_.end() && !misspelling_it->second.action.IsFinal()) { misspelling_it->second.action.Finalize(); @@ -157,29 +156,24 @@ std::vector<int> Feedback::GetRendersWithMisspellings() const { std::vector<int> renderers_with_misspellings; - for (RendererHashesMap::const_iterator renderer_it = renderers_.begin(); - renderer_it != renderers_.end(); ++renderer_it) { - if (!renderer_it->second.empty()) - renderers_with_misspellings.push_back(renderer_it->first); + for (const auto& renderer : renderers_) { + if (!renderer.second.empty()) + renderers_with_misspellings.push_back(renderer.first); } return renderers_with_misspellings; } void Feedback::FinalizeAllMisspellings() { - for (HashMisspellingMap::iterator misspelling_it = misspellings_.begin(); - misspelling_it != misspellings_.end(); ++misspelling_it) { - if (!misspelling_it->second.action.IsFinal()) - misspelling_it->second.action.Finalize(); + for (auto& misspelling : misspellings_) { + if (!misspelling.second.action.IsFinal()) + misspelling.second.action.Finalize(); } } std::vector<Misspelling> Feedback::GetAllMisspellings() const { std::vector<Misspelling> all_misspellings; - for (HashMisspellingMap::const_iterator misspelling_it = - misspellings_.begin(); - misspelling_it != misspellings_.end(); ++misspelling_it) { - all_misspellings.push_back(misspelling_it->second); - } + for (const auto& misspelling : misspellings_) + all_misspellings.push_back(misspelling.second); return all_misspellings; }
diff --git a/chrome/browser/spellchecker/feedback_sender.cc b/chrome/browser/spellchecker/feedback_sender.cc index 4bfb824..27be020 100644 --- a/chrome/browser/spellchecker/feedback_sender.cc +++ b/chrome/browser/spellchecker/feedback_sender.cc
@@ -93,30 +93,29 @@ result.hash); } -// Builds suggestion info from |suggestions|. The caller owns the result. -base::ListValue* BuildSuggestionInfo( - const std::vector<Misspelling>& suggestions, +// Builds suggestion info from |suggestions|. +scoped_ptr<base::ListValue> BuildSuggestionInfo( + const std::vector<Misspelling>& misspellings, bool is_first_feedback_batch) { - base::ListValue* list = new base::ListValue; - for (std::vector<Misspelling>::const_iterator suggestion_it = - suggestions.begin(); - suggestion_it != suggestions.end(); - ++suggestion_it) { - base::DictionaryValue* suggestion = SerializeMisspelling(*suggestion_it); - suggestion->SetBoolean("isFirstInSession", is_first_feedback_batch); - suggestion->SetBoolean("isAutoCorrection", false); - list->Append(suggestion); + scoped_ptr<base::ListValue> list(new base::ListValue); + for (const auto& raw_misspelling : misspellings) { + scoped_ptr<base::DictionaryValue> misspelling( + SerializeMisspelling(raw_misspelling)); + misspelling->SetBoolean("isFirstInSession", is_first_feedback_batch); + misspelling->SetBoolean("isAutoCorrection", false); + list->Append(misspelling.release()); } return list; } // Builds feedback parameters from |suggestion_info|, |language|, and |country|. -// Takes ownership of |suggestion_list|. The caller owns the result. -base::DictionaryValue* BuildParams(base::ListValue* suggestion_info, - const std::string& language, - const std::string& country) { - base::DictionaryValue* params = new base::DictionaryValue; - params->Set("suggestionInfo", suggestion_info); +// Takes ownership of |suggestion_list|. +scoped_ptr<base::DictionaryValue> BuildParams( + scoped_ptr<base::ListValue> suggestion_info, + const std::string& language, + const std::string& country) { + scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue); + params->Set("suggestionInfo", suggestion_info.release()); params->SetString("key", google_apis::GetAPIKey()); params->SetString("language", language); params->SetString("originCountry", country); @@ -124,15 +123,15 @@ return params; } -// Builds feedback data from |params|. Takes ownership of |params|. The caller -// owns the result. -base::Value* BuildFeedbackValue(base::DictionaryValue* params, - const std::string& api_version) { - base::DictionaryValue* result = new base::DictionaryValue; - result->Set("params", params); +// Builds feedback data from |params|. Takes ownership of |params|. +scoped_ptr<base::Value> BuildFeedbackValue( + scoped_ptr<base::DictionaryValue> params, + const std::string& api_version) { + scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); + result->Set("params", params.release()); result->SetString("method", "spelling.feedback"); result->SetString("apiVersion", api_version); - return result; + return std::move(result); } // Returns true if the misspelling location is within text bounds. @@ -206,9 +205,8 @@ misspelling->timestamp = base::Time::Now(); const std::set<uint32_t>& hashes = feedback_.FindMisspellings(GetMisspelledString(*misspelling)); - for (std::set<uint32_t>::const_iterator hash_it = hashes.begin(); - hash_it != hashes.end(); ++hash_it) { - Misspelling* duplicate_misspelling = feedback_.GetMisspelling(*hash_it); + for (uint32_t hash : hashes) { + Misspelling* duplicate_misspelling = feedback_.GetMisspelling(hash); if (!duplicate_misspelling || duplicate_misspelling->action.IsFinal()) continue; duplicate_misspelling->action.set_type(SpellcheckAction::TYPE_ADD_TO_DICT); @@ -283,25 +281,22 @@ for (size_t i = 0; i < markers.size(); ++i) marker_map[markers[i].offset] = markers[i].hash; - for (std::vector<SpellCheckResult>::iterator result_it = results->begin(); - result_it != results->end(); - ++result_it) { - if (!IsInBounds(result_it->location, result_it->length, text.length())) + for (auto& result : *results) { + if (!IsInBounds(result.location, result.length, text.length())) continue; - MarkerMap::const_iterator marker_it = marker_map.find(result_it->location); + MarkerMap::const_iterator marker_it = marker_map.find(result.location); if (marker_it != marker_map.end() && feedback_.HasMisspelling(marker_it->second)) { // If the renderer already has a marker for this spellcheck result, then // set the hash of the spellcheck result to be the same as the marker. - result_it->hash = marker_it->second; + result.hash = marker_it->second; } else { // If the renderer does not yet have a marker for this spellcheck result, // then generate a new hash for the spellcheck result. - result_it->hash = BuildHash(session_start_, ++misspelling_counter_); + result.hash = BuildHash(session_start_, ++misspelling_counter_); } // Save the feedback data for the spellcheck result. - feedback_.AddMisspelling(renderer_process_id, - BuildFeedback(*result_it, text)); + feedback_.AddMisspelling(renderer_process_id, BuildFeedback(result, text)); } } @@ -375,14 +370,13 @@ std::vector<int> known_renderers = feedback_.GetRendersWithMisspellings(); std::sort(known_renderers.begin(), known_renderers.end()); std::vector<int> dead_renderers = - base::STLSetDifference<std::vector<int> >(known_renderers, - alive_renderers); - for (std::vector<int>::const_iterator it = dead_renderers.begin(); - it != dead_renderers.end(); - ++it) { + base::STLSetDifference<std::vector<int>>(known_renderers, + alive_renderers); + for (int renderer_process_id : dead_renderers) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&FeedbackSender::OnReceiveDocumentMarkers, - AsWeakPtr(), *it, std::vector<uint32_t>())); + FROM_HERE, + base::Bind(&FeedbackSender::OnReceiveDocumentMarkers, AsWeakPtr(), + renderer_process_id, std::vector<uint32_t>())); } } @@ -420,7 +414,7 @@ sender->SetUploadData("application/json", feedback); senders_.push_back(sender); - // Request context is NULL in testing. + // Request context is nullptr in testing. if (request_context_.get()) { sender->SetRequestContext(request_context_.get()); sender->Start();
diff --git a/chrome/browser/spellchecker/feedback_sender_unittest.cc b/chrome/browser/spellchecker/feedback_sender_unittest.cc index 7f3bf90d..b3a54c6 100644 --- a/chrome/browser/spellchecker/feedback_sender_unittest.cc +++ b/chrome/browser/spellchecker/feedback_sender_unittest.cc
@@ -65,7 +65,7 @@ class FeedbackSenderTest : public testing::Test { public: FeedbackSenderTest() : ui_thread_(content::BrowserThread::UI, &loop_) { - feedback_.reset(new FeedbackSender(NULL, kLanguage, kCountry)); + feedback_.reset(new FeedbackSender(nullptr, kLanguage, kCountry)); feedback_->StartFeedbackCollection(); } @@ -79,7 +79,7 @@ // TODO(rouslan): Remove the command-line switch. http://crbug.com/247726 base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableSpellingFeedbackFieldTrial); - feedback_.reset(new FeedbackSender(NULL, kLanguage, kCountry)); + feedback_.reset(new FeedbackSender(nullptr, kLanguage, kCountry)); feedback_->StartFeedbackCollection(); } @@ -92,7 +92,7 @@ field_trial_ = base::FieldTrialList::CreateFieldTrial( kFeedbackFieldTrialName, kFeedbackFieldTrialEnabledGroupName); field_trial_->group(); - feedback_.reset(new FeedbackSender(NULL, kLanguage, kCountry)); + feedback_.reset(new FeedbackSender(nullptr, kLanguage, kCountry)); feedback_->StartFeedbackCollection(); } @@ -196,7 +196,8 @@ feedback_->OnReceiveDocumentMarkers(kRendererProcessId, std::vector<uint32_t>()); EXPECT_TRUE(UploadDataContains("\"actionType\":\"SELECT\"")); - EXPECT_TRUE(UploadDataContains("\"actionTargetIndex\":" + kSuggestionIndex)); + EXPECT_TRUE(UploadDataContains("\"actionTargetIndex\":" + + base::StringPrintf("%d", kSuggestionIndex))); } // Send ADD_TO_DICT feedback message if the user has added the misspelled word @@ -422,9 +423,9 @@ scoped_ptr<base::DictionaryValue> actual(static_cast<base::DictionaryValue*>( base::JSONReader::Read(actual_data).release())); actual->SetString("params.key", "TestDummyKey"); - base::ListValue* suggestions = NULL; + base::ListValue* suggestions = nullptr; actual->GetList("params.suggestionInfo", &suggestions); - base::DictionaryValue* suggestion = NULL; + base::DictionaryValue* suggestion = nullptr; suggestions->GetDictionary(0, &suggestion); suggestion->SetString("suggestionId", "42"); suggestion->SetString("timestamp", "9001");
diff --git a/chrome/browser/spellchecker/misspelling.cc b/chrome/browser/spellchecker/misspelling.cc index 86deb0d0..a540cc9 100644 --- a/chrome/browser/spellchecker/misspelling.cc +++ b/chrome/browser/spellchecker/misspelling.cc
@@ -14,19 +14,19 @@ namespace { -// Builds a value from a list of spellcheck suggestions. The caller owns the -// result. -base::Value* BuildSuggestionsValue(const std::vector<base::string16>& list) { - base::ListValue* result = new base::ListValue; +// Builds a value from a list of spellcheck suggestions. +scoped_ptr<base::Value> BuildSuggestionsValue( + const std::vector<base::string16>& list) { + scoped_ptr<base::ListValue> result(new base::ListValue); result->AppendStrings(list); - return result; + return std::move(result); } -// Builds a value from a spellcheck action. The caller owns the result. -base::Value* BuildUserActionValue(const SpellcheckAction& action) { - base::ListValue* result = new base::ListValue; +// Builds a value from a spellcheck action. +scoped_ptr<base::Value> BuildUserActionValue(const SpellcheckAction& action) { + scoped_ptr<base::ListValue> result(new base::ListValue); result->Append(action.Serialize()); - return result; + return std::move(result); } } // namespace @@ -48,8 +48,9 @@ Misspelling::~Misspelling() {} -base::DictionaryValue* SerializeMisspelling(const Misspelling& misspelling) { - base::DictionaryValue* result = new base::DictionaryValue; +scoped_ptr<base::DictionaryValue> SerializeMisspelling( + const Misspelling& misspelling) { + scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); result->SetString( "timestamp", base::Int64ToString(static_cast<long>(misspelling.timestamp.ToJsTime()))); @@ -57,8 +58,10 @@ result->SetInteger("misspelledStart", misspelling.location); result->SetString("originalText", misspelling.context); result->SetString("suggestionId", base::UintToString(misspelling.hash)); - result->Set("suggestions", BuildSuggestionsValue(misspelling.suggestions)); - result->Set("userActions", BuildUserActionValue(misspelling.action)); + result->Set("suggestions", + BuildSuggestionsValue(misspelling.suggestions).release()); + result->Set("userActions", + BuildUserActionValue(misspelling.action).release()); return result; }
diff --git a/chrome/browser/spellchecker/misspelling.h b/chrome/browser/spellchecker/misspelling.h index 44bd78a..43b6474 100644 --- a/chrome/browser/spellchecker/misspelling.h +++ b/chrome/browser/spellchecker/misspelling.h
@@ -17,6 +17,7 @@ #include <vector> +#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "chrome/browser/spellchecker/spellcheck_action.h" @@ -63,9 +64,9 @@ base::Time timestamp; }; -// Serializes the data in this object into a dictionary value. The caller owns -// the result. -base::DictionaryValue* SerializeMisspelling(const Misspelling& misspelling); +// Serializes the data in this object into a dictionary value. +scoped_ptr<base::DictionaryValue> SerializeMisspelling( + const Misspelling& misspelling); // Returns the substring of |context| that begins at |location| and contains // |length| characters.
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index c9d113f..52a2430 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -96,14 +96,14 @@ std::set<std::string>* to_add) { DCHECK(to_add); // Do not add duplicate words. - std::set<std::string> new_words = - base::STLSetDifference<std::set<std::string>>(*to_add, existing); + std::vector<std::string> new_words = + base::STLSetDifference<std::vector<std::string>>(*to_add, existing); int result = VALID_CHANGE; if (to_add->size() != new_words.size()) result |= DETECTED_DUPLICATE_WORDS; // Do not add invalid words. std::set<std::string> valid_new_words; - for (const std::string& word : new_words) { + for (const auto& word : new_words) { if (IsValidWord(word)) valid_new_words.insert(valid_new_words.end(), word); } @@ -333,13 +333,10 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_EQ(syncer::DICTIONARY, type); syncer::SyncDataList data; - std::string word; size_t i = 0; - for (auto it = words_.begin(); - it != words_.end() && - i < chrome::spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS; - ++it, ++i) { - word = *it; + for (const auto& word : words_) { + if (i++ >= chrome::spellcheck_common::MAX_SYNCABLE_DICTIONARY_WORDS) + break; sync_pb::EntitySpecifics specifics; specifics.mutable_dictionary()->set_word(word); data.push_back(syncer::SyncData::CreateLocalData(word, word, specifics)); @@ -445,12 +442,8 @@ words_.insert(dictionary_change.to_add().begin(), dictionary_change.to_add().end()); } - if (!dictionary_change.to_remove().empty()) { - std::set<std::string> updated_words = - base::STLSetDifference<std::set<std::string>>( - words_, dictionary_change.to_remove()); - std::swap(words_, updated_words); - } + for (const auto& word : dictionary_change.to_remove()) + words_.erase(word); } void SpellcheckCustomDictionary::FixInvalidFile( @@ -493,9 +486,9 @@ syncer::SyncChangeList sync_change_list; int i = 0; - for (auto it = dictionary_change.to_add().begin(); - it != dictionary_change.to_add().end() && i < upload_size; ++it, ++i) { - const std::string& word = *it; + for (const auto& word : dictionary_change.to_add()) { + if (i++ >= upload_size) + break; sync_pb::EntitySpecifics specifics; specifics.mutable_dictionary()->set_word(word); sync_change_list.push_back(syncer::SyncChange(
diff --git a/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc b/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc deleted file mode 100644 index 02a8c9a7..0000000 --- a/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.cc +++ /dev/null
@@ -1,55 +0,0 @@ -// Copyright 2015 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. - -#include "chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h" - -#include <utility> - -#include "base/android/jni_android.h" -#include "base/android/jni_array.h" -#include "base/android/jni_string.h" -#include "components/password_manager/core/common/credential_manager_types.h" -#include "jni/AutoSigninFirstRunInfoBar_jni.h" - -AutoSigninFirstRunInfoBar::AutoSigninFirstRunInfoBar( - scoped_ptr<AutoSigninFirstRunInfoBarDelegate> delegate) - : ConfirmInfoBar(std::move(delegate)) {} - -AutoSigninFirstRunInfoBar::~AutoSigninFirstRunInfoBar() {} - -base::android::ScopedJavaLocalRef<jobject> -AutoSigninFirstRunInfoBar::CreateRenderInfoBar(JNIEnv* env) { - using base::android::ConvertUTF16ToJavaString; - using base::android::ScopedJavaLocalRef; - AutoSigninFirstRunInfoBarDelegate* auto_signin_infobar_delegate = - static_cast<AutoSigninFirstRunInfoBarDelegate*>(delegate()); - ScopedJavaLocalRef<jstring> ok_button_text = ConvertUTF16ToJavaString( - env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); - ScopedJavaLocalRef<jstring> cancel_button_text = ConvertUTF16ToJavaString( - env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); - ScopedJavaLocalRef<jstring> explanation_text = ConvertUTF16ToJavaString( - env, auto_signin_infobar_delegate->GetExplanation()); - ScopedJavaLocalRef<jstring> message_text = ConvertUTF16ToJavaString( - env, auto_signin_infobar_delegate->GetMessageText()); - - return Java_AutoSigninFirstRunInfoBar_show( - env, message_text.obj(), ok_button_text.obj(), explanation_text.obj(), - auto_signin_infobar_delegate->message_link_range().start(), - auto_signin_infobar_delegate->message_link_range().end()); -} - -void AutoSigninFirstRunInfoBar::OnLinkClicked( - JNIEnv* env, - const JavaParamRef<jobject>& obj) { - GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB); -} - -bool AutoSigninFirstRunInfoBar::Register(JNIEnv* env) { - return RegisterNativesImpl(env); -} - -scoped_ptr<infobars::InfoBar> CreateAutoSigninFirstRunInfoBar( - scoped_ptr<AutoSigninFirstRunInfoBarDelegate> delegate) { - return make_scoped_ptr(new AutoSigninFirstRunInfoBar(std::move(delegate))); -}
diff --git a/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h b/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h deleted file mode 100644 index e905e1a..0000000 --- a/chrome/browser/ui/android/infobars/auto_signin_first_run_infobar.h +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2015 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 CHROME_BROWSER_UI_ANDROID_INFOBARS_AUTO_SIGNIN_FIRST_RUN_INFOBAR_H_ -#define CHROME_BROWSER_UI_ANDROID_INFOBARS_AUTO_SIGNIN_FIRST_RUN_INFOBAR_H_ - -#include "base/macros.h" -#include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h" -#include "chrome/browser/ui/android/infobars/confirm_infobar.h" - -// The Android infobar that offers the user the ability to save a password -// for the site. -class AutoSigninFirstRunInfoBar : public ConfirmInfoBar { - public: - explicit AutoSigninFirstRunInfoBar( - scoped_ptr<AutoSigninFirstRunInfoBarDelegate> delegate); - - ~AutoSigninFirstRunInfoBar() override; - - static bool Register(JNIEnv* env); - - private: - // ConfirmInfoBar: - base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( - JNIEnv* env) override; - void OnLinkClicked(JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj) override; - - DISALLOW_COPY_AND_ASSIGN(AutoSigninFirstRunInfoBar); -}; - -#endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_AUTO_SIGNIN_FIRST_RUN_INFOBAR_H_
diff --git a/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc b/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc index 2edc8a5..c3e6d6a2 100644 --- a/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc +++ b/chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.cc
@@ -7,7 +7,6 @@ #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "chrome/browser/android/tab_android.h" -#include "chrome/browser/password_manager/auto_signin_first_run_infobar_delegate.h" #include "chrome/browser/profiles/profile.h" #include "chrome/grit/generated_resources.h" #include "components/password_manager/core/browser/password_bubble_experiment.h" @@ -17,22 +16,15 @@ void ShowAutoSigninPrompt(content::WebContents* web_contents, const base::string16& username) { - Profile* profile = - Profile::FromBrowserContext(web_contents->GetBrowserContext()); base::string16 message = l10n_util::GetStringFUTF16( IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, username); - if (password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience( - profile->GetPrefs())) { - AutoSigninFirstRunInfoBarDelegate::Create(web_contents, message); - } else { - JNIEnv* env = base::android::AttachCurrentThread(); - TabAndroid* tab = TabAndroid::FromWebContents(web_contents); - ScopedJavaLocalRef<jstring> java_message = - base::android::ConvertUTF16ToJavaString(env, message); - Java_AutoSigninSnackbarController_showSnackbar( - env, tab->GetJavaObject().obj(), java_message.obj()); - } + JNIEnv* env = base::android::AttachCurrentThread(); + TabAndroid* tab = TabAndroid::FromWebContents(web_contents); + ScopedJavaLocalRef<jstring> java_message = + base::android::ConvertUTF16ToJavaString(env, message); + Java_AutoSigninSnackbarController_showSnackbar( + env, tab->GetJavaObject().obj(), java_message.obj()); } bool RegisterAutoSigninSnackbarController(JNIEnv* env) {
diff --git a/chrome/browser/ui/app_list/app_context_menu.cc b/chrome/browser/ui/app_list/app_context_menu.cc index 3f847a62..f8394343 100644 --- a/chrome/browser/ui/app_list/app_context_menu.cc +++ b/chrome/browser/ui/app_list/app_context_menu.cc
@@ -4,42 +4,13 @@ #include "chrome/browser/ui/app_list/app_context_menu.h" -#include "base/bind.h" -#include "build/build_config.h" -#include "chrome/browser/extensions/context_menu_matcher.h" -#include "chrome/browser/extensions/extension_util.h" -#include "chrome/browser/extensions/menu_manager.h" -#include "chrome/browser/prefs/incognito_mode_prefs.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" -#include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" -#include "content/public/common/context_menu_params.h" -#include "extensions/common/manifest_url_handlers.h" #include "ui/base/l10n/l10n_util.h" -#if defined(USE_ASH) -#include "ash/shell.h" -#endif - namespace app_list { -namespace { - -bool disable_installed_extension_check_for_testing = false; - -bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { - return item->contexts().Contains(extensions::MenuItem::LAUNCHER); -} - -} // namespace - -// static -void AppContextMenu::DisableInstalledExtensionCheckForTesting(bool disable) { - disable_installed_extension_check_for_testing = disable; -} - AppContextMenu::AppContextMenu(AppContextMenuDelegate* delegate, Profile* profile, const std::string& app_id, @@ -47,143 +18,47 @@ : delegate_(delegate), profile_(profile), app_id_(app_id), - controller_(controller), - is_platform_app_(false), - is_search_result_(false), - is_in_folder_(false) { + controller_(controller) { } AppContextMenu::~AppContextMenu() { } ui::MenuModel* AppContextMenu::GetMenuModel() { - if (!disable_installed_extension_check_for_testing && - !controller_->IsExtensionInstalled(profile_, app_id_)) { - return NULL; - } - if (menu_model_.get()) return menu_model_.get(); menu_model_.reset(new ui::SimpleMenuModel(this)); - - if (app_id_ == extension_misc::kChromeAppId) { - menu_model_->AddItemWithStringId( - MENU_NEW_WINDOW, - IDS_APP_LIST_NEW_WINDOW); - if (!profile_->IsOffTheRecord()) { - menu_model_->AddItemWithStringId( - MENU_NEW_INCOGNITO_WINDOW, - IDS_APP_LIST_NEW_INCOGNITO_WINDOW); - } - if (controller_->CanDoShowAppInfoFlow()) { - menu_model_->AddItemWithStringId(SHOW_APP_INFO, - IDS_APP_CONTEXT_MENU_SHOW_INFO); - } - } else { - extension_menu_items_.reset(new extensions::ContextMenuMatcher( - profile_, this, menu_model_.get(), - base::Bind(MenuItemHasLauncherContext))); - - // First, add the primary actions. - if (!is_platform_app_) - menu_model_->AddItem(LAUNCH_NEW, base::string16()); - - // Show Pin/Unpin option if shelf is available. - if (controller_->GetPinnable(app_id_) != - AppListControllerDelegate::NO_PIN) { - menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); - menu_model_->AddItemWithStringId( - TOGGLE_PIN, - controller_->IsAppPinned(app_id_) ? - IDS_APP_LIST_CONTEXT_MENU_UNPIN : - IDS_APP_LIST_CONTEXT_MENU_PIN); - } - - if (controller_->CanDoCreateShortcutsFlow()) { - menu_model_->AddItemWithStringId(CREATE_SHORTCUTS, - IDS_NEW_TAB_APP_CREATE_SHORTCUT); - } - menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); - - if (!is_platform_app_) { - // When bookmark apps are enabled, hosted apps can only toggle between - // USE_LAUNCH_TYPE_WINDOW and USE_LAUNCH_TYPE_REGULAR. - if (extensions::util::CanHostedAppsOpenInWindows() && - extensions::util::IsNewBookmarkAppsEnabled()) { - // When both flags are enabled, only allow toggling between - // USE_LAUNCH_TYPE_WINDOW and USE_LAUNCH_TYPE_REGULAR - menu_model_->AddCheckItemWithStringId( - USE_LAUNCH_TYPE_WINDOW, IDS_APP_CONTEXT_MENU_OPEN_WINDOW); - } else if (!extensions::util::IsNewBookmarkAppsEnabled()) { - // When new bookmark apps are disabled, add pinned and full screen - // options as well. Add open as window if CanHostedAppsOpenInWindows - // is enabled. - menu_model_->AddCheckItemWithStringId( - USE_LAUNCH_TYPE_REGULAR, - IDS_APP_CONTEXT_MENU_OPEN_REGULAR); - menu_model_->AddCheckItemWithStringId( - USE_LAUNCH_TYPE_PINNED, - IDS_APP_CONTEXT_MENU_OPEN_PINNED); - if (extensions::util::CanHostedAppsOpenInWindows()) { - menu_model_->AddCheckItemWithStringId( - USE_LAUNCH_TYPE_WINDOW, - IDS_APP_CONTEXT_MENU_OPEN_WINDOW); - } -#if defined(OS_MACOSX) - // Mac does not support standalone web app browser windows or maximize. - menu_model_->AddCheckItemWithStringId( - USE_LAUNCH_TYPE_FULLSCREEN, - IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN); -#else - // Even though the launch type is Full Screen it is more accurately - // described as Maximized in Ash. - menu_model_->AddCheckItemWithStringId( - USE_LAUNCH_TYPE_FULLSCREEN, - IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); -#endif - } - menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); - } - - // Assign unique IDs to commands added by the app itself. - int index = USE_LAUNCH_TYPE_COMMAND_END; - extension_menu_items_->AppendExtensionItems( - extensions::MenuItem::ExtensionKey(app_id_), - base::string16(), - &index, - false); // is_action_menu - - // If at least 1 item was added, add another separator after the list. - if (index > USE_LAUNCH_TYPE_COMMAND_END) - menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); - - if (!is_platform_app_) - menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); - - menu_model_->AddItemWithStringId(UNINSTALL, - is_platform_app_ - ? IDS_APP_LIST_UNINSTALL_ITEM - : IDS_APP_LIST_EXTENSIONS_UNINSTALL); - - if (controller_->CanDoShowAppInfoFlow()) { - menu_model_->AddItemWithStringId(SHOW_APP_INFO, - IDS_APP_CONTEXT_MENU_SHOW_INFO); - } - } - + BuildMenu(menu_model_.get()); return menu_model_.get(); } +void AppContextMenu::BuildMenu(ui::SimpleMenuModel* menu_model) { + // Show Pin/Unpin option if shelf is available. + if (controller_->GetPinnable(app_id()) != AppListControllerDelegate::NO_PIN) { + menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); + menu_model_->AddItemWithStringId( + TOGGLE_PIN, + controller_->IsAppPinned(app_id_) ? + IDS_APP_LIST_CONTEXT_MENU_UNPIN : + IDS_APP_LIST_CONTEXT_MENU_PIN); + } + + if (controller_->CanDoCreateShortcutsFlow()) { + menu_model_->AddItemWithStringId(CREATE_SHORTCUTS, + IDS_NEW_TAB_APP_CREATE_SHORTCUT); + } +} + bool AppContextMenu::IsItemForCommandIdDynamic(int command_id) const { - return command_id == TOGGLE_PIN || command_id == LAUNCH_NEW; + return command_id == TOGGLE_PIN; } base::string16 AppContextMenu::GetLabelForCommandId(int command_id) const { if (command_id == TOGGLE_PIN) { // Return "{Pin to, Unpin from} shelf" or "Pinned by administrator". // Note this only exists on Ash desktops. - if (controller_->GetPinnable(app_id_) == + if (controller_->GetPinnable(app_id()) == AppListControllerDelegate::PIN_FIXED) { return l10n_util::GetStringUTF16( IDS_APP_LIST_CONTEXT_MENU_PIN_ENFORCED_BY_POLICY); @@ -193,37 +68,11 @@ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN); } - DCHECK_EQ(LAUNCH_NEW, command_id); - -#if defined(OS_MACOSX) - // Full screen on Mac launches in a tab. - bool launches_in_window = extensions::util::CanHostedAppsOpenInWindows() && - IsCommandIdChecked(USE_LAUNCH_TYPE_WINDOW); -#else - // If --enable-new-bookmark-apps is enabled, then only check if - // USE_LAUNCH_TYPE_WINDOW is checked, as USE_LAUNCH_TYPE_PINNED (i.e. open - // as pinned tab) and fullscreen-by-default windows do not exist. - bool launches_in_window = - (extensions::util::IsNewBookmarkAppsEnabled() - ? IsCommandIdChecked(USE_LAUNCH_TYPE_WINDOW) - : !(IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) || - IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR))); -#endif - - return launches_in_window ? - l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW) : - l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB); + NOTREACHED(); + return base::string16(); } bool AppContextMenu::IsCommandIdChecked(int command_id) const { - if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && - command_id < USE_LAUNCH_TYPE_COMMAND_END) { - return static_cast<int>(controller_->GetExtensionLaunchType( - profile_, app_id_)) + USE_LAUNCH_TYPE_COMMAND_START == command_id; - } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( - command_id)) { - return extension_menu_items_->IsCommandIdChecked(command_id); - } return false; } @@ -231,70 +80,25 @@ if (command_id == TOGGLE_PIN) { return controller_->GetPinnable(app_id_) == AppListControllerDelegate::PIN_EDITABLE; - } else if (command_id == OPTIONS) { - return controller_->HasOptionsPage(profile_, app_id_); - } else if (command_id == UNINSTALL) { - return controller_->UserMayModifySettings(profile_, app_id_); - } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( - command_id)) { - return extension_menu_items_->IsCommandIdEnabled(command_id); - } else if (command_id == MENU_NEW_WINDOW) { - // "Normal" windows are not allowed when incognito is enforced. - return IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != - IncognitoModePrefs::FORCED; - } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { - // Incognito windows are not allowed when incognito is disabled. - return IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != - IncognitoModePrefs::DISABLED; } return true; } -bool AppContextMenu::GetAcceleratorForCommandId( - int command_id, - ui::Accelerator* accelerator) { +bool AppContextMenu::GetAcceleratorForCommandId(int command_id, + ui::Accelerator* accelerator) { return false; } void AppContextMenu::ExecuteCommand(int command_id, int event_flags) { - if (command_id == LAUNCH_NEW) { - delegate_->ExecuteLaunchCommand(event_flags); - } else if (command_id == TOGGLE_PIN && - controller_->GetPinnable(app_id_) == - AppListControllerDelegate::PIN_EDITABLE) { + if (command_id == TOGGLE_PIN && + controller_->GetPinnable(app_id_) == + AppListControllerDelegate::PIN_EDITABLE) { if (controller_->IsAppPinned(app_id_)) controller_->UnpinApp(app_id_); else controller_->PinApp(app_id_); } else if (command_id == CREATE_SHORTCUTS) { controller_->DoCreateShortcutsFlow(profile_, app_id_); - } else if (command_id == SHOW_APP_INFO) { - controller_->DoShowAppInfoFlow(profile_, app_id_); - } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && - command_id < USE_LAUNCH_TYPE_COMMAND_END) { - extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( - command_id - USE_LAUNCH_TYPE_COMMAND_START); - // When bookmark apps are enabled, hosted apps can only toggle between - // LAUNCH_TYPE_WINDOW and LAUNCH_TYPE_REGULAR. - if (extensions::util::IsNewBookmarkAppsEnabled()) { - launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == - extensions::LAUNCH_TYPE_WINDOW) - ? extensions::LAUNCH_TYPE_REGULAR - : extensions::LAUNCH_TYPE_WINDOW; - } - controller_->SetExtensionLaunchType(profile_, app_id_, launch_type); - } else if (command_id == OPTIONS) { - controller_->ShowOptionsPage(profile_, app_id_); - } else if (command_id == UNINSTALL) { - controller_->UninstallApp(profile_, app_id_); - } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( - command_id)) { - extension_menu_items_->ExecuteCommand(command_id, NULL, - content::ContextMenuParams()); - } else if (command_id == MENU_NEW_WINDOW) { - controller_->CreateNewWindow(profile_, false); - } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { - controller_->CreateNewWindow(profile_, true); } }
diff --git a/chrome/browser/ui/app_list/app_context_menu.h b/chrome/browser/ui/app_list/app_context_menu.h index e7f9c69b..a6e9c7c 100644 --- a/chrome/browser/ui/app_list/app_context_menu.h +++ b/chrome/browser/ui/app_list/app_context_menu.h
@@ -14,16 +14,14 @@ class AppListControllerDelegate; class Profile; -namespace extensions { -class ContextMenuMatcher; -} - namespace app_list { class AppContextMenuDelegate; +// Base class of all context menus in app list view. class AppContextMenu : public ui::SimpleMenuModel::Delegate { public: + // Defines command ids, used in context menu of all types. enum CommandId { LAUNCH_NEW = 100, TOGGLE_PIN, @@ -43,28 +41,11 @@ USE_LAUNCH_TYPE_COMMAND_END, }; - AppContextMenu(AppContextMenuDelegate* delegate, - Profile* profile, - const std::string& app_id, - AppListControllerDelegate* controller); ~AppContextMenu() override; - static void DisableInstalledExtensionCheckForTesting(bool disable); + // Note this could return nullptr if corresponding app item is gone. + virtual ui::MenuModel* GetMenuModel(); - // Note this could return NULL if corresponding extension is gone. - ui::MenuModel* GetMenuModel(); - - void set_is_platform_app(bool is_platform_app) { - is_platform_app_ = is_platform_app; - } - void set_is_search_result(bool is_search_result) { - is_search_result_ = is_search_result; - } - void set_is_in_folder(bool is_in_folder) { - is_in_folder_ = is_in_folder; - } - - private: // ui::SimpleMenuModel::Delegate overrides: bool IsItemForCommandIdDynamic(int command_id) const override; base::string16 GetLabelForCommandId(int command_id) const override; @@ -74,16 +55,28 @@ ui::Accelerator* accelerator) override; void ExecuteCommand(int command_id, int event_flags) override; + protected: + AppContextMenu(AppContextMenuDelegate* delegate, + Profile* profile, + const std::string& app_id, + AppListControllerDelegate* controller); + + // Creates default items, derived class may override to add their specific + // items. + virtual void BuildMenu(ui::SimpleMenuModel* menu_model); + + const std::string& app_id() const { return app_id_; } + Profile* profile() const { return profile_; } + AppContextMenuDelegate* delegate() const { return delegate_; } + AppListControllerDelegate* controller() const { return controller_; } + + private: AppContextMenuDelegate* delegate_; Profile* profile_; const std::string app_id_; AppListControllerDelegate* controller_; - bool is_platform_app_; - bool is_search_result_; - bool is_in_folder_; scoped_ptr<ui::SimpleMenuModel> menu_model_; - scoped_ptr<extensions::ContextMenuMatcher> extension_menu_items_; DISALLOW_COPY_AND_ASSIGN(AppContextMenu); };
diff --git a/chrome/browser/ui/app_list/app_context_menu_unittest.cc b/chrome/browser/ui/app_list/app_context_menu_unittest.cc index 1772d7b..de2a179a 100644 --- a/chrome/browser/ui/app_list/app_context_menu_unittest.cc +++ b/chrome/browser/ui/app_list/app_context_menu_unittest.cc
@@ -11,10 +11,10 @@ #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/menu_manager_factory.h" -#include "chrome/browser/ui/app_list/app_context_menu.h" #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_list_test_util.h" +#include "chrome/browser/ui/app_list/extension_app_context_menu.h" #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/test/base/testing_profile.h" #include "components/keyed_service/core/keyed_service.h" @@ -170,10 +170,10 @@ controller_->SetCanCreateShortcuts(can_create_shortcuts); controller_->SetCanShowAppInfo(can_show_app_info); controller_->SetExtensionLaunchType(profile(), app_id, launch_type); - app_list::AppContextMenu menu(menu_delegate(), - profile(), - app_id, - controller()); + app_list::ExtensionAppContextMenu menu(menu_delegate(), + profile(), + app_id, + controller()); menu.set_is_platform_app(platform_app); ui::MenuModel* menu_model = menu.GetMenuModel(); ASSERT_NE(nullptr, menu_model); @@ -245,10 +245,10 @@ controller_.reset(new FakeAppListControllerDelegate()); controller_->SetCanCreateShortcuts(can_create_shortcuts); controller_->SetCanShowAppInfo(can_show_app_info); - app_list::AppContextMenu menu(menu_delegate(), - profile(), - extension_misc::kChromeAppId, - controller()); + app_list::ExtensionAppContextMenu menu(menu_delegate(), + profile(), + extension_misc::kChromeAppId, + controller()); ui::MenuModel* menu_model = menu.GetMenuModel(); ASSERT_NE(nullptr, menu_model); @@ -273,7 +273,8 @@ }; TEST_F(AppContextMenuTest, ExtensionApp) { - app_list::AppContextMenu::DisableInstalledExtensionCheckForTesting(false); + app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( + false); for (extensions::LaunchType launch_type = extensions::LAUNCH_TYPE_FIRST; launch_type < extensions::NUM_LAUNCH_TYPES; launch_type = static_cast<extensions::LaunchType>(launch_type+1)) { @@ -307,7 +308,8 @@ } TEST_F(AppContextMenuTest, ChromeApp) { - app_list::AppContextMenu::DisableInstalledExtensionCheckForTesting(true); + app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( + true); for (size_t combinations = 0; combinations < (1 << 2); ++combinations) { TestChromeApp((combinations & (1 << 0)) != 0, (combinations & (1 << 1)) != 0); @@ -315,11 +317,12 @@ } TEST_F(AppContextMenuTest, NonExistingExtensionApp) { - app_list::AppContextMenu::DisableInstalledExtensionCheckForTesting(false); - app_list::AppContextMenu menu(menu_delegate(), - profile(), - "some_non_existing_extension_app", - controller()); + app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( + false); + app_list::ExtensionAppContextMenu menu(menu_delegate(), + profile(), + "some_non_existing_extension_app", + controller()); ui::MenuModel* menu_model = menu.GetMenuModel(); EXPECT_EQ(nullptr, menu_model); }
diff --git a/chrome/browser/ui/app_list/extension_app_context_menu.cc b/chrome/browser/ui/app_list/extension_app_context_menu.cc new file mode 100644 index 0000000..65a3a48 --- /dev/null +++ b/chrome/browser/ui/app_list/extension_app_context_menu.cc
@@ -0,0 +1,251 @@ +// Copyright 2016 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. + +#include "chrome/browser/ui/app_list/extension_app_context_menu.h" + +#include "chrome/browser/extensions/context_menu_matcher.h" +#include "chrome/browser/extensions/extension_util.h" +#include "chrome/browser/extensions/menu_manager.h" +#include "chrome/browser/prefs/incognito_mode_prefs.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/app_context_menu_delegate.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" +#include "chrome/grit/chromium_strings.h" +#include "chrome/grit/generated_resources.h" +#include "content/public/common/context_menu_params.h" +#include "ui/base/l10n/l10n_util.h" + +namespace app_list { + +namespace { + +bool disable_installed_extension_check_for_testing = false; + +bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { + return item->contexts().Contains(extensions::MenuItem::LAUNCHER); +} + +} // namespace + +// static +void ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( + bool disable) { + disable_installed_extension_check_for_testing = disable; +} + +ExtensionAppContextMenu::ExtensionAppContextMenu( + AppContextMenuDelegate* delegate, + Profile* profile, + const std::string& app_id, + AppListControllerDelegate* controller) + : AppContextMenu(delegate, profile, app_id, controller) { +} + +ExtensionAppContextMenu::~ExtensionAppContextMenu() { +} + +ui::MenuModel* ExtensionAppContextMenu::GetMenuModel() { + if (!disable_installed_extension_check_for_testing && + !controller()->IsExtensionInstalled(profile(), app_id())) { + return nullptr; + } + + return AppContextMenu::GetMenuModel(); +} + +void ExtensionAppContextMenu::BuildMenu(ui::SimpleMenuModel* menu_model) { + if (app_id() == extension_misc::kChromeAppId) { + menu_model->AddItemWithStringId( + MENU_NEW_WINDOW, + IDS_APP_LIST_NEW_WINDOW); + if (!profile()->IsOffTheRecord()) { + menu_model->AddItemWithStringId( + MENU_NEW_INCOGNITO_WINDOW, + IDS_APP_LIST_NEW_INCOGNITO_WINDOW); + } + if (controller()->CanDoShowAppInfoFlow()) { + menu_model->AddItemWithStringId(SHOW_APP_INFO, + IDS_APP_CONTEXT_MENU_SHOW_INFO); + } + } else { + extension_menu_items_.reset(new extensions::ContextMenuMatcher( + profile(), this, menu_model, + base::Bind(MenuItemHasLauncherContext))); + + // First, add the primary actions. + if (!is_platform_app_) + menu_model->AddItem(LAUNCH_NEW, base::string16()); + + // Create default items. + AppContextMenu::BuildMenu(menu_model); + menu_model->AddSeparator(ui::NORMAL_SEPARATOR); + + if (!is_platform_app_) { + // When bookmark apps are enabled, hosted apps can only toggle between + // USE_LAUNCH_TYPE_WINDOW and USE_LAUNCH_TYPE_REGULAR. + if (extensions::util::CanHostedAppsOpenInWindows() && + extensions::util::IsNewBookmarkAppsEnabled()) { + // When both flags are enabled, only allow toggling between + // USE_LAUNCH_TYPE_WINDOW and USE_LAUNCH_TYPE_REGULAR + menu_model->AddCheckItemWithStringId( + USE_LAUNCH_TYPE_WINDOW, IDS_APP_CONTEXT_MENU_OPEN_WINDOW); + } else if (!extensions::util::IsNewBookmarkAppsEnabled()) { + // When new bookmark apps are disabled, add pinned and full screen + // options as well. Add open as window if CanHostedAppsOpenInWindows + // is enabled. + menu_model->AddCheckItemWithStringId( + USE_LAUNCH_TYPE_REGULAR, + IDS_APP_CONTEXT_MENU_OPEN_REGULAR); + menu_model->AddCheckItemWithStringId( + USE_LAUNCH_TYPE_PINNED, + IDS_APP_CONTEXT_MENU_OPEN_PINNED); + if (extensions::util::CanHostedAppsOpenInWindows()) { + menu_model->AddCheckItemWithStringId( + USE_LAUNCH_TYPE_WINDOW, + IDS_APP_CONTEXT_MENU_OPEN_WINDOW); + } +#if defined(OS_MACOSX) + // Mac does not support standalone web app browser windows or maximize. + menu_model->AddCheckItemWithStringId( + USE_LAUNCH_TYPE_FULLSCREEN, + IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN); +#else + // Even though the launch type is Full Screen it is more accurately + // described as Maximized in Ash. + menu_model->AddCheckItemWithStringId( + USE_LAUNCH_TYPE_FULLSCREEN, + IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); +#endif + } + menu_model->AddSeparator(ui::NORMAL_SEPARATOR); + } + + // Assign unique IDs to commands added by the app itself. + int index = USE_LAUNCH_TYPE_COMMAND_END; + extension_menu_items_->AppendExtensionItems( + extensions::MenuItem::ExtensionKey(app_id()), + base::string16(), + &index, + false); // is_action_menu + + // If at least 1 item was added, add another separator after the list. + if (index > USE_LAUNCH_TYPE_COMMAND_END) + menu_model->AddSeparator(ui::NORMAL_SEPARATOR); + + if (!is_platform_app_) + menu_model->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); + + menu_model->AddItemWithStringId(UNINSTALL, + is_platform_app_ + ? IDS_APP_LIST_UNINSTALL_ITEM + : IDS_APP_LIST_EXTENSIONS_UNINSTALL); + + if (controller()->CanDoShowAppInfoFlow()) { + menu_model->AddItemWithStringId(SHOW_APP_INFO, + IDS_APP_CONTEXT_MENU_SHOW_INFO); + } + } +} + +bool ExtensionAppContextMenu::IsItemForCommandIdDynamic(int command_id) const { + return command_id == LAUNCH_NEW || + AppContextMenu::IsItemForCommandIdDynamic(command_id); +} + +base::string16 ExtensionAppContextMenu::GetLabelForCommandId( + int command_id) const { + if (command_id == TOGGLE_PIN) + return AppContextMenu::GetLabelForCommandId(command_id); + + DCHECK_EQ(LAUNCH_NEW, command_id); + +#if defined(OS_MACOSX) + // Full screen on Mac launches in a tab. + bool launches_in_window = extensions::util::CanHostedAppsOpenInWindows() && + IsCommandIdChecked(USE_LAUNCH_TYPE_WINDOW); +#else + // If --enable-new-bookmark-apps is enabled, then only check if + // USE_LAUNCH_TYPE_WINDOW is checked, as USE_LAUNCH_TYPE_PINNED (i.e. open + // as pinned tab) and fullscreen-by-default windows do not exist. + bool launches_in_window = + (extensions::util::IsNewBookmarkAppsEnabled() + ? IsCommandIdChecked(USE_LAUNCH_TYPE_WINDOW) + : !(IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) || + IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR))); +#endif + + return launches_in_window ? + l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW) : + l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB); +} + +bool ExtensionAppContextMenu::IsCommandIdChecked(int command_id) const { + if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && + command_id < USE_LAUNCH_TYPE_COMMAND_END) { + return static_cast<int>(controller()->GetExtensionLaunchType( + profile(), app_id())) + USE_LAUNCH_TYPE_COMMAND_START == command_id; + } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( + command_id)) { + return extension_menu_items_->IsCommandIdChecked(command_id); + } + return AppContextMenu::IsCommandIdChecked(command_id); +} + +bool ExtensionAppContextMenu::IsCommandIdEnabled(int command_id) const { + if (command_id == OPTIONS) { + return controller()->HasOptionsPage(profile(), app_id()); + } else if (command_id == UNINSTALL) { + return controller()->UserMayModifySettings(profile(), app_id()); + } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( + command_id)) { + return extension_menu_items_->IsCommandIdEnabled(command_id); + } else if (command_id == MENU_NEW_WINDOW) { + // "Normal" windows are not allowed when incognito is enforced. + return IncognitoModePrefs::GetAvailability(profile()->GetPrefs()) != + IncognitoModePrefs::FORCED; + } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { + // Incognito windows are not allowed when incognito is disabled. + return IncognitoModePrefs::GetAvailability(profile()->GetPrefs()) != + IncognitoModePrefs::DISABLED; + } + return AppContextMenu::IsCommandIdEnabled(command_id); +} + +void ExtensionAppContextMenu::ExecuteCommand(int command_id, int event_flags) { + if (command_id == LAUNCH_NEW) { + delegate()->ExecuteLaunchCommand(event_flags); + } else if (command_id == SHOW_APP_INFO) { + controller()->DoShowAppInfoFlow(profile(), app_id()); + } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && + command_id < USE_LAUNCH_TYPE_COMMAND_END) { + extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( + command_id - USE_LAUNCH_TYPE_COMMAND_START); + // When bookmark apps are enabled, hosted apps can only toggle between + // LAUNCH_TYPE_WINDOW and LAUNCH_TYPE_REGULAR. + if (extensions::util::IsNewBookmarkAppsEnabled()) { + launch_type = (controller()->GetExtensionLaunchType(profile(), + app_id()) == + extensions::LAUNCH_TYPE_WINDOW) + ? extensions::LAUNCH_TYPE_REGULAR + : extensions::LAUNCH_TYPE_WINDOW; + } + controller()->SetExtensionLaunchType(profile(), app_id(), launch_type); + } else if (command_id == OPTIONS) { + controller()->ShowOptionsPage(profile(), app_id()); + } else if (command_id == UNINSTALL) { + controller()->UninstallApp(profile(), app_id()); + } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( + command_id)) { + extension_menu_items_->ExecuteCommand(command_id, nullptr, + content::ContextMenuParams()); + } else if (command_id == MENU_NEW_WINDOW) { + controller()->CreateNewWindow(profile(), false); + } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { + controller()->CreateNewWindow(profile(), true); + } else { + AppContextMenu::ExecuteCommand(command_id, event_flags); + } +} + +} // namespace app_list
diff --git a/chrome/browser/ui/app_list/extension_app_context_menu.h b/chrome/browser/ui/app_list/extension_app_context_menu.h new file mode 100644 index 0000000..39b8f37 --- /dev/null +++ b/chrome/browser/ui/app_list/extension_app_context_menu.h
@@ -0,0 +1,60 @@ +// Copyright 2016 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 CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ +#define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ + +#include <string> + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/ui/app_list/app_context_menu.h" + +class AppListControllerDelegate; +class Profile; + +namespace extensions { +class ContextMenuMatcher; +} + +namespace app_list { + +class AppContextMenuDelegate; + +class ExtensionAppContextMenu : public AppContextMenu { + public: + ExtensionAppContextMenu(AppContextMenuDelegate* delegate, + Profile* profile, + const std::string& app_id, + AppListControllerDelegate* controller); + ~ExtensionAppContextMenu() override; + + static void DisableInstalledExtensionCheckForTesting(bool disable); + + // AppListContextMenu overrides: + ui::MenuModel* GetMenuModel() override; + void BuildMenu(ui::SimpleMenuModel* menu_model) override; + + // ui::SimpleMenuModel::Delegate overrides: + base::string16 GetLabelForCommandId(int command_id) const override; + bool IsItemForCommandIdDynamic(int command_id) const override; + bool IsCommandIdChecked(int command_id) const override; + bool IsCommandIdEnabled(int command_id) const override; + void ExecuteCommand(int command_id, int event_flags) override; + + void set_is_platform_app(bool is_platform_app) { + is_platform_app_ = is_platform_app; + } + + private: + bool is_platform_app_ = false; + + scoped_ptr<extensions::ContextMenuMatcher> extension_menu_items_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionAppContextMenu); +}; + +} // namespace app_list + +#endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_
diff --git a/chrome/browser/ui/app_list/extension_app_item.cc b/chrome/browser/ui/app_list/extension_app_item.cc index e5ed3ec..c2a18ad 100644 --- a/chrome/browser/ui/app_list/extension_app_item.cc +++ b/chrome/browser/ui/app_list/extension_app_item.cc
@@ -11,8 +11,8 @@ #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_context_menu.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" +#include "chrome/browser/ui/app_list/extension_app_context_menu.h" #include "chrome/browser/ui/extensions/extension_enable_flow.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_metrics.h" @@ -311,11 +311,11 @@ } ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { - context_menu_.reset(new app_list::AppContextMenu( - this, profile(), extension_id(), GetController())); + context_menu_.reset(new app_list::ExtensionAppContextMenu(this, + profile(), + extension_id(), + GetController())); context_menu_->set_is_platform_app(is_platform_app_); - if (IsInFolder()) - context_menu_->set_is_in_folder(true); return context_menu_->GetMenuModel(); }
diff --git a/chrome/browser/ui/app_list/extension_app_item.h b/chrome/browser/ui/app_list/extension_app_item.h index 6742802..87a42a21 100644 --- a/chrome/browser/ui/app_list/extension_app_item.h +++ b/chrome/browser/ui/app_list/extension_app_item.h
@@ -21,7 +21,7 @@ class Profile; namespace app_list { -class AppContextMenu; +class ExtensionAppContextMenu; } namespace extensions { @@ -100,7 +100,7 @@ void UpdatePositionFromOrdering(); scoped_ptr<extensions::IconImage> icon_; - scoped_ptr<app_list::AppContextMenu> context_menu_; + scoped_ptr<app_list::ExtensionAppContextMenu> context_menu_; scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; AppListControllerDelegate* extension_enable_flow_controller_;
diff --git a/chrome/browser/ui/app_list/search/app_result.cc b/chrome/browser/ui/app_list/search/app_result.cc index 7b4853c8..55ab840 100644 --- a/chrome/browser/ui/app_list/search/app_result.cc +++ b/chrome/browser/ui/app_list/search/app_result.cc
@@ -7,8 +7,8 @@ #include "base/time/time.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_context_menu.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" +#include "chrome/browser/ui/app_list/extension_app_context_menu.h" #include "chrome/browser/ui/app_list/search/search_util.h" #include "chrome/browser/ui/extensions/extension_enable_flow.h" #include "chrome/common/extensions/extension_metrics.h" @@ -121,10 +121,9 @@ ui::MenuModel* AppResult::GetContextMenuModel() { if (!context_menu_) { - context_menu_.reset(new AppContextMenu( + context_menu_.reset(new ExtensionAppContextMenu( this, profile_, app_id_, controller_)); context_menu_->set_is_platform_app(is_platform_app_); - context_menu_->set_is_search_result(true); } return context_menu_->GetMenuModel();
diff --git a/chrome/browser/ui/app_list/search/app_result.h b/chrome/browser/ui/app_list/search/app_result.h index 620fe99..6d27a9c7 100644 --- a/chrome/browser/ui/app_list/search/app_result.h +++ b/chrome/browser/ui/app_list/search/app_result.h
@@ -29,7 +29,7 @@ namespace app_list { -class AppContextMenu; +class ExtensionAppContextMenu; class AppResult : public SearchResult, public extensions::IconImage::Observer, @@ -84,7 +84,7 @@ bool is_platform_app_; scoped_ptr<extensions::IconImage> icon_; - scoped_ptr<AppContextMenu> context_menu_; + scoped_ptr<ExtensionAppContextMenu> context_menu_; scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; extensions::ExtensionRegistry* extension_registry_;
diff --git a/chrome/browser/ui/cocoa/browser_window_command_handler.mm b/chrome/browser/ui/cocoa/browser_window_command_handler.mm index 4f88b46e4..192fd49f 100644 --- a/chrome/browser/ui/cocoa/browser_window_command_handler.mm +++ b/chrome/browser/ui/cocoa/browser_window_command_handler.mm
@@ -219,6 +219,13 @@ [menuItem setHidden:YES]; enable = NO; } + break; + } + case IDC_SHOW_AS_TAB: { + // Hide this menu option if the window is tabbed. + NSMenuItem* menuItem = base::mac::ObjCCast<NSMenuItem>(item); + [menuItem setHidden:browser->is_type_tabbed()]; + break; } default: // Special handling for the contents of the Text Encoding submenu. On
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc index 064f37b6..b090316 100644 --- a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc +++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
@@ -128,17 +128,6 @@ title, title_link_range); } -void GetAutoSigninPromptFirstRunExperienceExplanation( - bool is_smartlock_branding_enabled, - base::string16* explanation, - gfx::Range* explanation_link_range) { - GetBrandedTextAndLinkRange( - is_smartlock_branding_enabled, - IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_SMART_LOCK_WELCOME, - IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_DEFAULT_WELCOME, - explanation, explanation_link_range); -} - void GetBrandedTextAndLinkRange(bool is_smartlock_branding_enabled, int smartlock_string_id, int default_string_id,
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.h b/chrome/browser/ui/passwords/manage_passwords_view_utils.h index 0a68c53..011e0c4 100644 --- a/chrome/browser/ui/passwords/manage_passwords_view_utils.h +++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.h
@@ -70,12 +70,6 @@ base::string16* title, gfx::Range* title_link_range); -// TODO(melandory): remove as obsolete. http://crbug.com/532876 -void GetAutoSigninPromptFirstRunExperienceExplanation( - bool is_smartlock_branding_enabled, - base::string16* explanation, - gfx::Range* explanation_link_range); - // Loads |smartlock_string_id| or |default_string_id| string from the resources // and substitutes the placeholder with the correct password manager branding // (Google Smart Lock, Google Chrome or Chromium) according to
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view_interactive_uitest.cc b/chrome/browser/ui/views/location_bar/page_action_image_view_interactive_uitest.cc index 160dcd30..80576d9 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view_interactive_uitest.cc
@@ -13,7 +13,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" -#include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" +#include "chrome/test/base/interactive_test_utils.h" #include "extensions/common/constants.h" #include "extensions/common/feature_switch.h" #include "extensions/test/extension_test_message_listener.h" @@ -132,7 +132,7 @@ { base::RunLoop run_loop; gfx::Point page_action_center = - test::GetCenterInScreenCoordinates(page_action_view); + ui_test_utils::GetCenterInScreenCoordinates(page_action_view); ui_controls::SendMouseMoveNotifyWhenDone(page_action_center.x(), page_action_center.y(), run_loop.QuitClosure()); @@ -162,7 +162,7 @@ { base::RunLoop run_loop; gfx::Point page_action_center = - test::GetCenterInScreenCoordinates(page_action_view); + ui_test_utils::GetCenterInScreenCoordinates(page_action_view); ui_controls::SendMouseMoveNotifyWhenDone(page_action_center.x(), page_action_center.y(), run_loop.QuitClosure());
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 09b19e87e..9512448 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -111,12 +111,6 @@ DISALLOW_COPY_AND_ASSIGN(QuitDraggingObserver); }; -gfx::Point GetCenterInScreenCoordinates(const views::View* view) { - gfx::Point center(view->width() / 2, view->height() / 2); - views::View::ConvertPointToScreen(view, ¢er); - return center; -} - void SetID(WebContents* web_contents, int id) { web_contents->SetUserData(&kTabDragControllerInteractiveUITestUserDataKey, new TabDragControllerInteractiveUITestUserData(id)); @@ -157,7 +151,7 @@ } // namespace test -using test::GetCenterInScreenCoordinates; +using ui_test_utils::GetCenterInScreenCoordinates; using test::SetID; using test::ResetIDs; using test::IDString;
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h index 0339dc6c..8aa0a40 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h
@@ -56,9 +56,6 @@ // Returns the TabStrip for |browser|. TabStrip* GetTabStripForBrowser(Browser* browser); -// Returns the center of |view| in screen coordinates. -gfx::Point GetCenterInScreenCoordinates(const views::View* view); - // Sets the id of |web_contents| to |id|. void SetID(content::WebContents* web_contents, int id);
diff --git a/chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc b/chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc index eced0ba..8c77e14 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc
@@ -57,7 +57,7 @@ // Click on the toolbar action to activate it. gfx::Point action_view_loc = - test::GetCenterInScreenCoordinates(action_view); + ui_test_utils::GetCenterInScreenCoordinates(action_view); ui_controls::SendMouseMove(action_view_loc.x(), action_view_loc.y()); ui_controls::SendMouseEventsNotifyWhenDone( button, ui_controls::DOWN | ui_controls::UP, quit_closure); @@ -127,7 +127,7 @@ EXPECT_TRUE(second_row_action->enabled()); gfx::Point action_view_loc = - test::GetCenterInScreenCoordinates(second_row_action); + ui_test_utils::GetCenterInScreenCoordinates(second_row_action); gfx::Point action_view_loc_in_menu_item_bounds = action_view_loc; views::View::ConvertPointFromScreen(first_menu_item, &action_view_loc_in_menu_item_bounds); @@ -215,7 +215,7 @@ // Click on the app button. gfx::Point app_button_loc = - test::GetCenterInScreenCoordinates(app_menu_button); + ui_test_utils::GetCenterInScreenCoordinates(app_menu_button); base::RunLoop loop; ui_controls::SendMouseMove(app_button_loc.x(), app_button_loc.y()); ui_controls::SendMouseEventsNotifyWhenDone( @@ -278,7 +278,7 @@ AppMenuButton* app_menu_button = GetAppButtonFromBrowser(browser()); // Click on the app button, and then right-click on the first toolbar action. gfx::Point app_button_loc = - test::GetCenterInScreenCoordinates(app_menu_button); + ui_test_utils::GetCenterInScreenCoordinates(app_menu_button); base::RunLoop loop; ui_controls::SendMouseMove(app_button_loc.x(), app_button_loc.y()); ui_controls::SendMouseEventsNotifyWhenDone( @@ -323,7 +323,7 @@ // Click on the action, and wait for the popup to fully load. EXPECT_TRUE(ui_test_utils::SendMouseMoveSync( - test::GetCenterInScreenCoordinates(toolbar_action_view))); + ui_test_utils::GetCenterInScreenCoordinates(toolbar_action_view))); EXPECT_TRUE(ui_test_utils::SendMouseEventsSync( ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP)); @@ -387,7 +387,7 @@ // keyboard. AppMenuButton* app_menu_button = GetAppButtonFromBrowser(browser()); gfx::Point app_button_loc = - test::GetCenterInScreenCoordinates(app_menu_button); + ui_test_utils::GetCenterInScreenCoordinates(app_menu_button); base::RunLoop loop; ui_controls::SendMouseMove(app_button_loc.x(), app_button_loc.y()); ui_controls::SendMouseEventsNotifyWhenDone(
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view_interactive_uitest.cc b/chrome/browser/ui/views/toolbar/toolbar_view_interactive_uitest.cc index 8c339aa..23beaa9 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view_interactive_uitest.cc
@@ -10,7 +10,6 @@ #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/test_with_browser_view.h" -#include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" #include "chrome/browser/ui/views/toolbar/app_menu_button.h" #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h" @@ -162,9 +161,10 @@ ToolbarActionView* view = browser_actions()->GetToolbarActionViewAt(0); ASSERT_TRUE(view); - gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view); - gfx::Point app_button_loc = - test::GetCenterInScreenCoordinates(toolbar_view()->app_menu_button()); + gfx::Point browser_action_view_loc = + ui_test_utils::GetCenterInScreenCoordinates(view); + gfx::Point app_button_loc = ui_test_utils::GetCenterInScreenCoordinates( + toolbar_view()->app_menu_button()); // Perform a drag and drop from the browser action view to the app button, // which should open the app menu.
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index cd5d21a..02fa77f 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi
@@ -947,8 +947,6 @@ 'browser/net/spdyproxy/data_reduction_proxy_settings_android.h', 'browser/password_manager/account_chooser_dialog_android.cc', 'browser/password_manager/account_chooser_dialog_android.h', - 'browser/password_manager/auto_signin_first_run_infobar_delegate.cc', - 'browser/password_manager/auto_signin_first_run_infobar_delegate.h', 'browser/password_manager/credential_android.cc', 'browser/password_manager/credential_android.h', 'browser/password_manager/generated_password_saved_infobar_delegate_android.cc', @@ -1934,7 +1932,6 @@ 'android/java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java', 'android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java', 'android/java/src/org/chromium/chrome/browser/infobar/SimpleConfirmInfoBarBuilder.java', - 'android/java/src/org/chromium/chrome/browser/infobar/AutoSigninFirstRunInfoBar.java', 'android/java/src/org/chromium/chrome/browser/invalidation/InvalidationServiceFactory.java', 'android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java', 'android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java',
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 8947387..599c291 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi
@@ -447,8 +447,6 @@ 'browser/ui/android/context_menu_helper.h', 'browser/ui/android/infobars/app_banner_infobar_android.cc', 'browser/ui/android/infobars/app_banner_infobar_android.h', - 'browser/ui/android/infobars/auto_signin_first_run_infobar.cc', - 'browser/ui/android/infobars/auto_signin_first_run_infobar.h', 'browser/ui/android/infobars/autofill_save_card_infobar.cc', 'browser/ui/android/infobars/autofill_save_card_infobar.h', 'browser/ui/android/infobars/confirm_infobar.cc', @@ -2609,6 +2607,8 @@ 'browser/ui/app_list/app_list_view_delegate.h', 'browser/ui/app_list/chrome_app_list_item.cc', 'browser/ui/app_list/chrome_app_list_item.h', + 'browser/ui/app_list/extension_app_context_menu.cc', + 'browser/ui/app_list/extension_app_context_menu.h', 'browser/ui/app_list/extension_app_item.cc', 'browser/ui/app_list/extension_app_item.h', 'browser/ui/app_list/extension_app_model_builder.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 528d89bd..6f2d260 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi
@@ -1050,9 +1050,7 @@ 'browser/ui/browser_focus_uitest.cc', 'browser/ui/cocoa/apps/app_shim_menu_controller_mac_interactive_uitest.mm', 'browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.mm', - 'browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm', 'browser/ui/cocoa/panels/panel_cocoa_browsertest.mm', - 'browser/ui/cocoa/translate/translate_bubble_test_utils_cocoa.mm', 'browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc', 'browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc', 'browser/ui/exclusive_access/fullscreen_controller_state_interactive_browsertest.cc', @@ -1087,7 +1085,7 @@ 'test/base/interactive_test_utils_aura.cc', 'test/base/interactive_test_utils_aura.h', 'test/base/interactive_test_utils_mac.mm', - 'test/base/interactive_test_utils_views.cc', + 'test/base/interactive_test_utils_common_views.cc', 'test/base/interactive_test_utils_win.cc', 'test/base/interactive_ui_tests_main.cc', 'test/base/view_event_test_platform_part.h', @@ -1121,6 +1119,12 @@ 'test/base/view_event_test_base.cc', 'test/base/view_event_test_base.h', ], + # Mac sources, except when mac_views_browser==1. + 'chrome_interactive_ui_test_cocoa_sources': [ + 'browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm', + 'browser/ui/cocoa/translate/translate_bubble_test_utils_cocoa.mm', + 'test/base/interactive_test_utils_cocoa.mm', + ], 'chrome_interactive_ui_test_app_list_sources': [ 'browser/ui/app_list/app_list_service_interactive_uitest.cc', 'browser/ui/app_list/app_list_service_mac_interactive_uitest.mm', @@ -1165,6 +1169,7 @@ 'browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc', 'browser/ui/views/toolbar/toolbar_view_interactive_uitest.cc', 'browser/ui/views/translate/translate_bubble_test_utils_views.cc', + 'test/base/interactive_test_utils_views.cc', ], 'chrome_interactive_ui_test_notifications_sources': [ 'browser/extensions/api/notifications/notifications_apitest.cc', @@ -1715,6 +1720,20 @@ ], # See comment about the same line in chrome/chrome_tests.gypi. 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']}, + 'conditions' : [ + # The browser window can be views or Cocoa on Mac. Test accordingly. + ['mac_views_browser==1', { + 'sources': [ '<@(chrome_interactive_ui_test_views_non_mac_sources)' ], + # Following tests needs a refactoring to works with mac_views. + 'sources!': [ + # Aura depended tests. + 'browser/ui/views/bookmarks/bookmark_bar_view_test.cc', + 'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc', + ] + }, { + 'sources': [ '<@(chrome_interactive_ui_test_cocoa_sources)' ], + }], # mac_views_browser==1 + ], }, { # Non-Mac. 'sources': [ '<@(chrome_interactive_ui_test_views_non_mac_sources)' ], }],
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 3e0032f9..2b30c97 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi
@@ -334,7 +334,6 @@ 'browser/password_manager/save_password_infobar_delegate_unittest.cc', ], 'chrome_unit_tests_android_sources': [ - 'browser/password_manager/auto_signin_infobar_delegate_unittest.cc', 'browser/permissions/permission_queue_controller_unittest.cc', ], 'chrome_unit_tests_non_mobile_sources': [
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index bc6d227e..df1f974 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -493,6 +493,25 @@ # when we tried to pull it up to the common.gypi level, it broke other # things like the ui and startup tests. *shrug* ldflags += [ "-Wl,-ObjC" ] + + # The browser window can be views or Cocoa on Mac. Test accordingly. + if (mac_views_browser) { + sources += rebase_path( + chrome_tests_gypi_values.chrome_interactive_ui_test_views_non_mac_sources, + ".", + "//chrome") + + # Aura depended tests. + sources -= [ + "../browser/ui/views/bookmarks/bookmark_bar_view_test.cc", + "../browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc", + ] + } else { + sources += rebase_path( + chrome_tests_gypi_values.chrome_interactive_ui_test_cocoa_sources, + ".", + "//chrome") + } } if (cld_version == 2) {
diff --git a/chrome/test/base/interactive_test_utils.h b/chrome/test/base/interactive_test_utils.h index e8c7a224..f0ccc770 100644 --- a/chrome/test/base/interactive_test_utils.h +++ b/chrome/test/base/interactive_test_utils.h
@@ -132,6 +132,9 @@ ui_controls::MouseButton button, int state, const base::Closure& task); + +// Returns the center of |view| in screen coordinates. +gfx::Point GetCenterInScreenCoordinates(const views::View* view); #endif namespace internal {
diff --git a/chrome/test/base/interactive_test_utils_cocoa.mm b/chrome/test/base/interactive_test_utils_cocoa.mm new file mode 100644 index 0000000..228c0a2 --- /dev/null +++ b/chrome/test/base/interactive_test_utils_cocoa.mm
@@ -0,0 +1,95 @@ +// Copyright 2016 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. + +#include "chrome/test/base/interactive_test_utils.h" + +#import <Cocoa/Cocoa.h> + +#include "base/bind.h" +#include "base/logging.h" +#include "base/message_loop/message_loop.h" +#include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_window.h" +#import "chrome/browser/ui/cocoa/view_id_util.h" + +namespace ui_test_utils { + +namespace { + +void MoveMouseToNSViewCenterAndPress( + NSView* view, + ui_controls::MouseButton button, + int state, + const base::Closure& task) { + NSWindow* window = [view window]; + NSScreen* screen = [window screen]; + DCHECK(screen); + + // Converts the center position of the view into the coordinates accepted + // by SendMouseMoveNotifyWhenDone() method. + NSRect bounds = [view bounds]; + NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); + center = [view convertPoint:center toView:nil]; + center = [window convertBaseToScreen:center]; + center = NSMakePoint(center.x, [screen frame].size.height - center.y); + + ui_controls::SendMouseMoveNotifyWhenDone( + center.x, center.y, + base::Bind(&internal::ClickTask, button, state, task)); +} + +} // namespace + +bool IsViewFocused(const Browser* browser, ViewID vid) { + NSWindow* window = browser->window()->GetNativeWindow(); + DCHECK(window); + NSView* view = view_id_util::GetView(window, vid); + if (!view) + return false; + + NSResponder* firstResponder = [window firstResponder]; + if (firstResponder == static_cast<NSResponder*>(view)) + return true; + + // Handle special case for VIEW_ID_TAB_CONTAINER. The tab container NSView + // always transfers first responder status to its subview, so test whether + // |firstResponder| is a descendant. + if (vid == VIEW_ID_TAB_CONTAINER && + [firstResponder isKindOfClass:[NSView class]]) + return [static_cast<NSView*>(firstResponder) isDescendantOf:view]; + + // Handle the special case of focusing a TextField. + if ([firstResponder isKindOfClass:[NSTextView class]]) { + NSView* delegate = static_cast<NSView*>([(NSTextView*)firstResponder + delegate]); + if (delegate == view) + return true; + } + + return false; +} + +void ClickOnView(const Browser* browser, ViewID vid) { + NSWindow* window = browser->window()->GetNativeWindow(); + DCHECK(window); + NSView* view = view_id_util::GetView(window, vid); + DCHECK(view); + MoveMouseToNSViewCenterAndPress( + view, + ui_controls::LEFT, + ui_controls::DOWN | ui_controls::UP, + base::MessageLoop::QuitWhenIdleClosure()); + content::RunMessageLoop(); +} + +void FocusView(const Browser* browser, ViewID vid) { + NSWindow* window = browser->window()->GetNativeWindow(); + DCHECK(window); + NSView* view = view_id_util::GetView(window, vid); + DCHECK(view); + [window makeFirstResponder:view]; + } + +} // namespace ui_test_utils
diff --git a/chrome/test/base/interactive_test_utils_common_views.cc b/chrome/test/base/interactive_test_utils_common_views.cc new file mode 100644 index 0000000..c28f5b48 --- /dev/null +++ b/chrome/test/base/interactive_test_utils_common_views.cc
@@ -0,0 +1,40 @@ +// Copyright 2016 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. + +// Methods compiled on all toolkit-views platforms (including Mac). + +#include "chrome/test/base/interactive_test_utils.h" + +#include "ui/compositor/layer.h" +#include "ui/compositor/layer_animator.h" +#include "ui/views/view.h" +#include "ui/views/widget/widget.h" + +namespace ui_test_utils { + +void MoveMouseToCenterAndPress(views::View* view, + ui_controls::MouseButton button, + int state, + const base::Closure& closure) { + DCHECK(view); + DCHECK(view->GetWidget()); + // Complete any in-progress animation before sending the events so that the + // mouse-event targetting happens reliably, and does not flake because of + // unreliable animation state. + ui::Layer* layer = view->GetWidget()->GetLayer(); + if (layer) { + ui::LayerAnimator* animator = layer->GetAnimator(); + if (animator && animator->is_animating()) + animator->StopAnimating(); + } + + gfx::Point view_center(view->width() / 2, view->height() / 2); + views::View::ConvertPointToScreen(view, &view_center); + ui_controls::SendMouseMoveNotifyWhenDone( + view_center.x(), + view_center.y(), + base::Bind(&internal::ClickTask, button, state, closure)); +} + +} // namespace ui_test_utils
diff --git a/chrome/test/base/interactive_test_utils_mac.mm b/chrome/test/base/interactive_test_utils_mac.mm index c1c3b10..0d00f3a 100644 --- a/chrome/test/base/interactive_test_utils_mac.mm +++ b/chrome/test/base/interactive_test_utils_mac.mm
@@ -7,94 +7,12 @@ #include <Carbon/Carbon.h> #import <Cocoa/Cocoa.h> -#include "base/bind.h" -#include "base/logging.h" #include "base/message_loop/message_loop.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_window.h" -#import "chrome/browser/ui/cocoa/view_id_util.h" -#include "ui/base/test/ui_controls.h" #import "ui/base/test/windowed_nsnotification_observer.h" namespace ui_test_utils { -namespace { - -void MoveMouseToNSViewCenterAndPress( - NSView* view, - ui_controls::MouseButton button, - int state, - const base::Closure& task) { - NSWindow* window = [view window]; - NSScreen* screen = [window screen]; - DCHECK(screen); - - // Converts the center position of the view into the coordinates accepted - // by SendMouseMoveNotifyWhenDone() method. - NSRect bounds = [view bounds]; - NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); - center = [view convertPoint:center toView:nil]; - center = [window convertBaseToScreen:center]; - center = NSMakePoint(center.x, [screen frame].size.height - center.y); - - ui_controls::SendMouseMoveNotifyWhenDone( - center.x, center.y, - base::Bind(&internal::ClickTask, button, state, task)); -} - -} // namespace - -bool IsViewFocused(const Browser* browser, ViewID vid) { - NSWindow* window = browser->window()->GetNativeWindow(); - DCHECK(window); - NSView* view = view_id_util::GetView(window, vid); - if (!view) - return false; - - NSResponder* firstResponder = [window firstResponder]; - if (firstResponder == static_cast<NSResponder*>(view)) - return true; - - // Handle special case for VIEW_ID_TAB_CONTAINER. The tab container NSView - // always transfers first responder status to its subview, so test whether - // |firstResponder| is a descendant. - if (vid == VIEW_ID_TAB_CONTAINER && - [firstResponder isKindOfClass:[NSView class]]) - return [static_cast<NSView*>(firstResponder) isDescendantOf:view]; - - // Handle the special case of focusing a TextField. - if ([firstResponder isKindOfClass:[NSTextView class]]) { - NSView* delegate = static_cast<NSView*>([(NSTextView*)firstResponder - delegate]); - if (delegate == view) - return true; - } - - return false; -} - -void ClickOnView(const Browser* browser, ViewID vid) { - NSWindow* window = browser->window()->GetNativeWindow(); - DCHECK(window); - NSView* view = view_id_util::GetView(window, vid); - DCHECK(view); - MoveMouseToNSViewCenterAndPress( - view, - ui_controls::LEFT, - ui_controls::DOWN | ui_controls::UP, - base::MessageLoop::QuitWhenIdleClosure()); - content::RunMessageLoop(); -} - -void FocusView(const Browser* browser, ViewID vid) { - NSWindow* window = browser->window()->GetNativeWindow(); - DCHECK(window); - NSView* view = view_id_util::GetView(window, vid); - DCHECK(view); - [window makeFirstResponder:view]; - } - void HideNativeWindow(gfx::NativeWindow window) { [window orderOut:nil]; }
diff --git a/chrome/test/base/interactive_test_utils_views.cc b/chrome/test/base/interactive_test_utils_views.cc index 7084e5d..f1dce9d 100644 --- a/chrome/test/base/interactive_test_utils_views.cc +++ b/chrome/test/base/interactive_test_utils_views.cc
@@ -4,22 +4,13 @@ #include "chrome/test/base/interactive_test_utils.h" -#include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "build/build_config.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/frame/browser_view.h" -#include "ui/base/test/ui_controls.h" -#include "ui/compositor/layer.h" -#include "ui/compositor/layer_animator.h" #include "ui/views/focus/focus_manager.h" namespace ui_test_utils { -// Until the whole browser UI is ported to tookit-views on Mac, these need to -// use the definitions in interactive_test_utils_mac.mm. -#if !defined(OS_MACOSX) - bool IsViewFocused(const Browser* browser, ViewID vid) { BrowserWindow* browser_window = browser->window(); DCHECK(browser_window); @@ -50,30 +41,10 @@ view->RequestFocus(); } -#endif // defined(OS_MACOSX) - -void MoveMouseToCenterAndPress(views::View* view, - ui_controls::MouseButton button, - int state, - const base::Closure& closure) { - DCHECK(view); - DCHECK(view->GetWidget()); - // Complete any in-progress animation before sending the events so that the - // mouse-event targetting happens reliably, and does not flake because of - // unreliable animation state. - ui::Layer* layer = view->GetWidget()->GetLayer(); - if (layer) { - ui::LayerAnimator* animator = layer->GetAnimator(); - if (animator && animator->is_animating()) - animator->StopAnimating(); - } - - gfx::Point view_center(view->width() / 2, view->height() / 2); - views::View::ConvertPointToScreen(view, &view_center); - ui_controls::SendMouseMoveNotifyWhenDone( - view_center.x(), - view_center.y(), - base::Bind(&internal::ClickTask, button, state, closure)); +gfx::Point GetCenterInScreenCoordinates(const views::View* view) { + gfx::Point center(view->width() / 2, view->height() / 2); + views::View::ConvertPointToScreen(view, ¢er); + return center; } } // namespace ui_test_utils
diff --git a/chromeos/hugepage_text/hugepage_text.cc b/chromeos/hugepage_text/hugepage_text.cc index 4856660f..ccae53f 100644 --- a/chromeos/hugepage_text/hugepage_text.cc +++ b/chromeos/hugepage_text/hugepage_text.cc
@@ -36,6 +36,11 @@ const int kMmapHtlbFlags = (kMmapFlags | MAP_HUGETLB); const int kMremapFlags = (MREMAP_MAYMOVE | MREMAP_FIXED); +// The number of hugepages we want to use to map chrome text section +// to hugepages. With the help of AutoFDO, the hot functions are grouped +// in to a small area of the binary. +const int kNumHugePages = 15; + // mremap syscall is always supported for small page segment on all kernels. // However, it is not the case for hugepage. // If not used carefully, mremap() a hugepage segment directly onto small page @@ -124,9 +129,10 @@ // Effect: physical backing page changed from small page to hugepage. If there // are error condition, the remapping operation is aborted. static void MremapHugetlbText(void* vaddr, const size_t hsize) { - DCHECK_EQ(0ul, reinterpret_cast<uintptr_t>(vaddr) & ~kHpageMask); void* haddr = MAP_FAILED; - if (HugetlbMremapSupported()) { + + if ((reinterpret_cast<intptr_t>(vaddr) & ~kHpageMask) == 0 && + HugetlbMremapSupported()) { // Try anon hugepage from static hugepage pool only if the source address // is hugepage aligned, otherwise, mremap below has non-recoverable error. haddr = mmap(NULL, hsize, kProtection, kMmapHtlbFlags, 0, 0); @@ -166,18 +172,15 @@ // Effect: physical backing page changed from small page to hugepage. If there // are error condition, the remaping operation is aborted. static void RemapHugetlbText(void* vaddr, const size_t segsize) { - // remove unaligned head regions - size_t head_gap = (kHpageSize - reinterpret_cast<size_t>(vaddr) % kHpageSize) - % kHpageSize; - size_t addr = reinterpret_cast<size_t>(vaddr) + head_gap; - - int hsize = segsize - head_gap; + int hsize = segsize; + if (segsize > kHpageSize * kNumHugePages) + hsize = kHpageSize * kNumHugePages; hsize = hsize & kHpageMask; if (hsize == 0) return; - MremapHugetlbText(reinterpret_cast<void *>(addr), hsize); + MremapHugetlbText(vaddr, hsize); } // For a given ELF program header descriptor, iterates over all segments within
diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc index 2425fd1..8a3a80fc 100644 --- a/components/bitmap_uploader/bitmap_uploader.cc +++ b/components/bitmap_uploader/bitmap_uploader.cc
@@ -50,7 +50,7 @@ surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT); surface_->BindToThread(); - shell->ConnectToService("mojo:mus", &gpu_service_); + shell->ConnectToInterface("mojo:mus", &gpu_service_); mus::mojom::CommandBufferPtr gles2_client; gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); gles2_context_ = MojoGLES2CreateContext(
diff --git a/components/clipboard/clipboard_apptest.cc b/components/clipboard/clipboard_apptest.cc index db45162..01b85cd 100644 --- a/components/clipboard/clipboard_apptest.cc +++ b/components/clipboard/clipboard_apptest.cc
@@ -58,7 +58,7 @@ void SetUp() override { mojo::test::ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:clipboard", &clipboard_); + shell()->ConnectToInterface("mojo:clipboard", &clipboard_); } uint64_t GetSequenceNumber() {
diff --git a/components/error_page/common/localized_error.cc b/components/error_page/common/localized_error.cc index a349802f..8895014 100644 --- a/components/error_page/common/localized_error.cc +++ b/components/error_page/common/localized_error.cc
@@ -837,6 +837,9 @@ suggestions->Append(suggest_network_prediction); } + // TODO(crbug.com/584615): Does it make sense to show all of these + // suggestions on mobile? Several of them seem irrelevant in the mobile + // context. if (options.suggestions & SUGGEST_FIREWALL_CONFIG) { base::DictionaryValue* suggest_firewall_config = new base::DictionaryValue; suggest_firewall_config->SetString("header",
diff --git a/components/filesystem/files_test_base.cc b/components/filesystem/files_test_base.cc index a221a69a..afc39a8 100644 --- a/components/filesystem/files_test_base.cc +++ b/components/filesystem/files_test_base.cc
@@ -21,7 +21,7 @@ void FilesTestBase::SetUp() { ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:filesystem", &files_); + shell()->ConnectToInterface("mojo:filesystem", &files_); } void FilesTestBase::OnFileSystemShutdown() {
diff --git a/components/filesystem/public/cpp/prefs/pref_service_factory.cc b/components/filesystem/public/cpp/prefs/pref_service_factory.cc index 0fbd0d7..5c75bb62 100644 --- a/components/filesystem/public/cpp/prefs/pref_service_factory.cc +++ b/components/filesystem/public/cpp/prefs/pref_service_factory.cc
@@ -26,7 +26,7 @@ scoped_ptr<PrefService> CreatePrefService(mojo::Shell* shell, PrefRegistry* pref_registry) { filesystem::FileSystemPtr filesystem; - shell->ConnectToService("mojo:filesystem", &filesystem); + shell->ConnectToInterface("mojo:filesystem", &filesystem); scoped_refptr<FilesystemJsonPrefStore> user_prefs = new FilesystemJsonPrefStore("preferences.json", std::move(filesystem),
diff --git a/components/font_service/public/cpp/font_loader.cc b/components/font_service/public/cpp/font_loader.cc index 8f7718cb..719d63d 100644 --- a/components/font_service/public/cpp/font_loader.cc +++ b/components/font_service/public/cpp/font_loader.cc
@@ -15,7 +15,7 @@ FontLoader::FontLoader(mojo::Shell* shell) { FontServicePtr font_service; - shell->ConnectToService("mojo:font_service", &font_service); + shell->ConnectToInterface("mojo:font_service", &font_service); thread_ = new internal::FontServiceThread(std::move(font_service)); }
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc index afda349..107e6f4a 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc
@@ -166,7 +166,7 @@ connection_id_ = 101; mojom::WindowTreeFactoryPtr factory; - shell->ConnectToService("mojo:mus", &factory); + shell->ConnectToInterface("mojo:mus", &factory); factory->CreateWindowTree(GetProxy(&tree_ptr_), binding_.CreateInterfacePtrAndBind()); tree_ = tree_ptr_.get();
diff --git a/components/mus/public/cpp/lib/window_tree_host_factory.cc b/components/mus/public/cpp/lib/window_tree_host_factory.cc index a475686..88c45d7d 100644 --- a/components/mus/public/cpp/lib/window_tree_host_factory.cc +++ b/components/mus/public/cpp/lib/window_tree_host_factory.cc
@@ -27,7 +27,7 @@ mojom::WindowTreeHostPtr* host, WindowManagerDelegate* window_manager_delegate) { mojom::WindowTreeHostFactoryPtr factory; - shell->ConnectToService("mojo:mus", &factory); + shell->ConnectToInterface("mojo:mus", &factory); CreateWindowTreeHost(factory.get(), delegate, host, window_manager_delegate); }
diff --git a/components/mus/ws/window_manager_client_apptest.cc b/components/mus/ws/window_manager_client_apptest.cc index 8d174d78..ac7e18e6 100644 --- a/components/mus/ws/window_manager_client_apptest.cc +++ b/components/mus/ws/window_manager_client_apptest.cc
@@ -275,7 +275,7 @@ // WindowTreeClient. mus::mojom::WindowTreeClientPtr ConnectAndGetWindowServerClient() { mus::mojom::WindowTreeClientPtr client; - shell()->ConnectToService(shell_url(), &client); + shell()->ConnectToInterface(shell_url(), &client); return client; }
diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc index 2951037..5bf60896 100644 --- a/components/mus/ws/window_tree_apptest.cc +++ b/components/mus/ws/window_tree_apptest.cc
@@ -71,7 +71,7 @@ base::RunLoop run_loop; { mojom::WindowTreeClientPtr client; - shell->ConnectToService(url.get(), &client); + shell->ConnectToInterface(url.get(), &client); ws->Embed(root_id, std::move(client), mojom::WindowTree::kAccessPolicyDefault, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); @@ -566,7 +566,7 @@ client_factory_.reset(new WindowTreeClientFactory()); mojom::WindowTreeHostFactoryPtr factory; - shell()->ConnectToService("mojo:mus", &factory); + shell()->ConnectToInterface("mojo:mus", &factory); mojom::WindowTreeClientPtr tree_client_ptr; ws_client1_.reset(new TestWindowTreeClientImpl());
diff --git a/components/resource_provider/public/cpp/resource_loader.cc b/components/resource_provider/public/cpp/resource_loader.cc index 866c594..1bd8b7c 100644 --- a/components/resource_provider/public/cpp/resource_loader.cc +++ b/components/resource_provider/public/cpp/resource_loader.cc
@@ -29,7 +29,7 @@ ResourceLoader::ResourceLoader(mojo::Shell* shell, const std::set<std::string>& paths) : loaded_(false), did_block_(false) { - shell->ConnectToService("mojo:resource_provider", &resource_provider_); + shell->ConnectToInterface("mojo:resource_provider", &resource_provider_); std::vector<std::string> paths_vector(paths.begin(), paths.end()); resource_provider_->GetResources( mojo::Array<mojo::String>::From(paths_vector),
diff --git a/components/scheduler/base/task_queue_impl.cc b/components/scheduler/base/task_queue_impl.cc index 5f0b4a1..5ce23f16 100644 --- a/components/scheduler/base/task_queue_impl.cc +++ b/components/scheduler/base/task_queue_impl.cc
@@ -127,8 +127,8 @@ main_thread_only().task_queue_manager = nullptr; main_thread_only().delayed_incoming_queue = std::priority_queue<Task>(); any_thread().immediate_incoming_queue = std::queue<Task>(); - main_thread_only().immediate_work_queue->Clear(); - main_thread_only().delayed_work_queue->Clear(); + main_thread_only().immediate_work_queue.reset(); + main_thread_only().delayed_work_queue.reset(); } bool TaskQueueImpl::RunsTasksOnCurrentThread() const { @@ -488,7 +488,7 @@ } void TaskQueueImpl::SetQueuePriority(QueuePriority priority) { - if (!main_thread_only().task_queue_manager) + if (!main_thread_only().task_queue_manager || priority == GetQueuePriority()) return; main_thread_only().task_queue_manager->selector_.SetQueuePriority(this, priority);
diff --git a/components/scheduler/base/task_queue_manager.cc b/components/scheduler/base/task_queue_manager.cc index 4e31a868..009d4ff6 100644 --- a/components/scheduler/base/task_queue_manager.cc +++ b/components/scheduler/base/task_queue_manager.cc
@@ -195,6 +195,8 @@ break; } + bool should_trigger_wakeup = work_queue->task_queue()->wakeup_policy() == + TaskQueue::WakeupPolicy::CAN_WAKE_OTHER_QUEUES; switch (ProcessTaskFromWorkQueue(work_queue, &previous_task)) { case ProcessTaskResult::DEFERRED: // If a task was deferred, try again with another task. Note that this @@ -206,8 +208,8 @@ case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: return; // The TaskQueueManager got deleted, we must bail out. } - bool should_trigger_wakeup = work_queue->task_queue()->wakeup_policy() == - TaskQueue::WakeupPolicy::CAN_WAKE_OTHER_QUEUES; + work_queue = nullptr; // The queue may have been unregistered. + UpdateWorkQueues(should_trigger_wakeup, &previous_task); // Only run a single task per batch in nested run loops so that we can
diff --git a/components/scheduler/base/task_queue_selector.cc b/components/scheduler/base/task_queue_selector.cc index 3120232..9db8ab9 100644 --- a/components/scheduler/base/task_queue_selector.cc +++ b/components/scheduler/base/task_queue_selector.cc
@@ -13,8 +13,8 @@ namespace internal { TaskQueueSelector::TaskQueueSelector() - : enabled_selector_(this), - blocked_selector_(this), + : enabled_selector_(this, "enabled"), + blocked_selector_(this, "blocked"), immediate_starvation_count_(0), high_priority_starvation_count_(0), num_blocked_queues_to_report_(0), @@ -25,17 +25,25 @@ void TaskQueueSelector::AddQueue(internal::TaskQueueImpl* queue) { DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(queue->IsQueueEnabled()); - SetQueuePriority(queue, TaskQueue::NORMAL_PRIORITY); + enabled_selector_.AddQueue(queue, TaskQueue::NORMAL_PRIORITY); } void TaskQueueSelector::RemoveQueue(internal::TaskQueueImpl* queue) { DCHECK(main_thread_checker_.CalledOnValidThread()); if (queue->IsQueueEnabled()) { enabled_selector_.RemoveQueue(queue); +// The #if DCHECK_IS_ON() shouldn't be necessary but this doesn't compile on +// chromeos bots without it :( +#if DCHECK_IS_ON() + DCHECK(!blocked_selector_.CheckContainsQueueForTest(queue)); +#endif } else if (queue->should_report_when_execution_blocked()) { DCHECK_GT(num_blocked_queues_to_report_, 0u); num_blocked_queues_to_report_--; blocked_selector_.RemoveQueue(queue); +#if DCHECK_IS_ON() + DCHECK(!enabled_selector_.CheckContainsQueueForTest(queue)); +#endif } } @@ -45,9 +53,9 @@ if (queue->should_report_when_execution_blocked()) { DCHECK_GT(num_blocked_queues_to_report_, 0u); num_blocked_queues_to_report_--; + blocked_selector_.RemoveQueue(queue); } - blocked_selector_.RemoveQueue(queue); - enabled_selector_.AssignQueueToSet(queue, queue->GetQueuePriority()); + enabled_selector_.AddQueue(queue, queue->GetQueuePriority()); if (task_queue_selector_observer_) task_queue_selector_observer_->OnTaskQueueEnabled(queue); } @@ -56,9 +64,10 @@ DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(!queue->IsQueueEnabled()); enabled_selector_.RemoveQueue(queue); - blocked_selector_.AssignQueueToSet(queue, queue->GetQueuePriority()); - if (queue->should_report_when_execution_blocked()) + if (queue->should_report_when_execution_blocked()) { + blocked_selector_.AddQueue(queue, queue->GetQueuePriority()); num_blocked_queues_to_report_++; + } } void TaskQueueSelector::SetQueuePriority(internal::TaskQueueImpl* queue, @@ -66,9 +75,15 @@ DCHECK_LT(priority, TaskQueue::QUEUE_PRIORITY_COUNT); DCHECK(main_thread_checker_.CalledOnValidThread()); if (queue->IsQueueEnabled()) { - enabled_selector_.AssignQueueToSet(queue, priority); + enabled_selector_.ChangeSetIndex(queue, priority); + } else if (queue->should_report_when_execution_blocked()) { + blocked_selector_.ChangeSetIndex(queue, priority); } else { - blocked_selector_.AssignQueueToSet(queue, priority); + // Normally blocked_selector_.ChangeSetIndex would assign the queue's + // priority, however if |queue->should_report_when_execution_blocked()| is + // false then the disabled queue is not in any set so we need to do it here. + queue->delayed_work_queue()->AssignSetIndex(priority); + queue->immediate_work_queue()->AssignSetIndex(priority); } DCHECK_EQ(priority, queue->GetQueuePriority()); } @@ -80,50 +95,50 @@ } TaskQueueSelector::PrioritizingSelector::PrioritizingSelector( - TaskQueueSelector* task_queue_selector) + TaskQueueSelector* task_queue_selector, + const char* name) : task_queue_selector_(task_queue_selector), - delayed_work_queue_sets_(TaskQueue::QUEUE_PRIORITY_COUNT), - immediate_work_queue_sets_(TaskQueue::QUEUE_PRIORITY_COUNT) {} + delayed_work_queue_sets_(TaskQueue::QUEUE_PRIORITY_COUNT, name), + immediate_work_queue_sets_(TaskQueue::QUEUE_PRIORITY_COUNT, name) {} -void TaskQueueSelector::PrioritizingSelector::AssignQueueToSet( +void TaskQueueSelector::PrioritizingSelector::AddQueue( internal::TaskQueueImpl* queue, TaskQueue::QueuePriority priority) { - delayed_work_queue_sets_.AssignQueueToSet(queue->delayed_work_queue(), - priority); - immediate_work_queue_sets_.AssignQueueToSet(queue->immediate_work_queue(), - priority); - // The #if DCHECK_IS_ON() shouldn't be necessary but this doesn't compile on - // chromeos bots without it :( #if DCHECK_IS_ON() - DCHECK_EQ(queue->delayed_work_queue()->Empty(), - !delayed_work_queue_sets_.ContainsWorkQueueForTest( - queue->delayed_work_queue())); - DCHECK_EQ(queue->immediate_work_queue()->Empty(), - !immediate_work_queue_sets_.ContainsWorkQueueForTest( - queue->immediate_work_queue())); + DCHECK(!CheckContainsQueueForTest(queue)); +#endif + delayed_work_queue_sets_.AddQueue(queue->delayed_work_queue(), priority); + immediate_work_queue_sets_.AddQueue(queue->immediate_work_queue(), priority); +#if DCHECK_IS_ON() + DCHECK(CheckContainsQueueForTest(queue)); +#endif +} + +void TaskQueueSelector::PrioritizingSelector::ChangeSetIndex( + internal::TaskQueueImpl* queue, + TaskQueue::QueuePriority priority) { +#if DCHECK_IS_ON() + DCHECK(CheckContainsQueueForTest(queue)); +#endif + delayed_work_queue_sets_.ChangeSetIndex(queue->delayed_work_queue(), + priority); + immediate_work_queue_sets_.ChangeSetIndex(queue->immediate_work_queue(), + priority); +#if DCHECK_IS_ON() + DCHECK(CheckContainsQueueForTest(queue)); #endif } void TaskQueueSelector::PrioritizingSelector::RemoveQueue( internal::TaskQueueImpl* queue) { #if DCHECK_IS_ON() - DCHECK_EQ(queue->delayed_work_queue()->Empty(), - !delayed_work_queue_sets_.ContainsWorkQueueForTest( - queue->delayed_work_queue())) - << " Did you try to RemoveQueue twice? Thats not supported!"; - DCHECK_EQ(queue->immediate_work_queue()->Empty(), - !immediate_work_queue_sets_.ContainsWorkQueueForTest( - queue->immediate_work_queue())) - << " Did you try to RemoveQueue twice? Thats not supported!"; + DCHECK(CheckContainsQueueForTest(queue)); #endif delayed_work_queue_sets_.RemoveQueue(queue->delayed_work_queue()); immediate_work_queue_sets_.RemoveQueue(queue->immediate_work_queue()); #if DCHECK_IS_ON() - DCHECK(!delayed_work_queue_sets_.ContainsWorkQueueForTest( - queue->delayed_work_queue())); - DCHECK(!immediate_work_queue_sets_.ContainsWorkQueueForTest( - queue->delayed_work_queue())); + DCHECK(!CheckContainsQueueForTest(queue)); #endif } @@ -220,6 +235,23 @@ return false; } +#if DCHECK_IS_ON() || !defined(NDEBUG) +bool +TaskQueueSelector::PrioritizingSelector::CheckContainsQueueForTest( + const internal::TaskQueueImpl* queue) const { + bool contains_delayed_work_queue = + delayed_work_queue_sets_.ContainsWorkQueueForTest( + queue->delayed_work_queue()); + + bool contains_immediate_work_queue = + immediate_work_queue_sets_.ContainsWorkQueueForTest( + queue->immediate_work_queue()); + + DCHECK_EQ(contains_delayed_work_queue, contains_immediate_work_queue); + return contains_delayed_work_queue; +} +#endif + bool TaskQueueSelector::SelectWorkQueueToService(WorkQueue** out_work_queue) { DCHECK(main_thread_checker_.CalledOnValidThread()); bool chose_delayed_over_immediate = false; @@ -239,6 +271,7 @@ } void TaskQueueSelector::TrySelectingBlockedQueue() { + DCHECK(main_thread_checker_.CalledOnValidThread()); if (!num_blocked_queues_to_report_ || !task_queue_selector_observer_) return; WorkQueue* chosen_blocked_queue; @@ -255,6 +288,7 @@ void TaskQueueSelector::TrySelectingBlockedQueueOverEnabledQueue( const WorkQueue& chosen_enabled_queue) { + DCHECK(main_thread_checker_.CalledOnValidThread()); if (!num_blocked_queues_to_report_ || !task_queue_selector_observer_) return; @@ -325,6 +359,7 @@ } bool TaskQueueSelector::EnabledWorkQueuesEmpty() const { + DCHECK(main_thread_checker_.CalledOnValidThread()); for (TaskQueue::QueuePriority priority = TaskQueue::CONTROL_PRIORITY; priority < TaskQueue::QUEUE_PRIORITY_COUNT; priority = NextPriority(priority)) {
diff --git a/components/scheduler/base/task_queue_selector.h b/components/scheduler/base/task_queue_selector.h index 80ec7c0..4a82adc 100644 --- a/components/scheduler/base/task_queue_selector.h +++ b/components/scheduler/base/task_queue_selector.h
@@ -85,10 +85,13 @@ protected: class SCHEDULER_EXPORT PrioritizingSelector { public: - PrioritizingSelector(TaskQueueSelector* task_queue_selector); + PrioritizingSelector(TaskQueueSelector* task_queue_selector, + const char* name); - void AssignQueueToSet(internal::TaskQueueImpl* queue, - TaskQueue::QueuePriority priority); + void ChangeSetIndex(internal::TaskQueueImpl* queue, + TaskQueue::QueuePriority priority); + void AddQueue(internal::TaskQueueImpl* queue, + TaskQueue::QueuePriority priority); void RemoveQueue(internal::TaskQueueImpl* queue); bool SelectWorkQueueToService(TaskQueue::QueuePriority max_priority, @@ -113,6 +116,10 @@ bool* out_chose_delayed_over_immediate, WorkQueue** out_work_queue) const; +#if DCHECK_IS_ON() || !defined(NDEBUG) + bool CheckContainsQueueForTest(const internal::TaskQueueImpl* queue) const; +#endif + private: bool ChooseOldestImmediateTaskWithPriority( TaskQueue::QueuePriority priority,
diff --git a/components/scheduler/base/task_queue_selector_unittest.cc b/components/scheduler/base/task_queue_selector_unittest.cc index 755e97e0..3d48ba9 100644 --- a/components/scheduler/base/task_queue_selector_unittest.cc +++ b/components/scheduler/base/task_queue_selector_unittest.cc
@@ -126,6 +126,10 @@ void TearDown() final { for (scoped_refptr<TaskQueueImpl>& task_queue : task_queues_) { task_queue->UnregisterTaskQueue(); + // Note since this test doesn't have a TaskQueueManager we need to + // manually remove |task_queue| from the |selector_|. Normally + // UnregisterTaskQueue would do that. + selector_.RemoveQueue(task_queue.get()); } } @@ -187,7 +191,7 @@ TEST_F(TaskQueueSelectorTest, TestObserverWithSetQueuePriorityAndQueueAlreadyEnabled) { - selector_.SetQueuePriority(task_queues_[1].get(), TaskQueue::NORMAL_PRIORITY); + selector_.SetQueuePriority(task_queues_[1].get(), TaskQueue::HIGH_PRIORITY); MockObserver mock_observer; selector_.SetTaskQueueSelectorObserver(&mock_observer); EXPECT_CALL(mock_observer, OnTaskQueueEnabled(_)).Times(0); @@ -294,7 +298,7 @@ PushTasks(queue_order, 2); selector_.SetQueuePriority(task_queues_[0].get(), TaskQueue::BEST_EFFORT_PRIORITY); - selector_.SetQueuePriority(task_queues_[1].get(), TaskQueue::NORMAL_PRIORITY); + EXPECT_EQ(TaskQueue::NORMAL_PRIORITY, task_queues_[1]->GetQueuePriority()); WorkQueue* chosen_work_queue = nullptr; for (int i = 0; i < 100; i++) { EXPECT_TRUE(selector_.SelectWorkQueueToService(&chosen_work_queue)); @@ -390,6 +394,7 @@ EXPECT_FALSE(selector.SelectWorkQueueToService(&chosen_work_queue)); task_queue->UnregisterTaskQueue(); + selector.RemoveQueue(task_queue.get()); } TEST_F(TaskQueueSelectorTest, TestObserverWithTwoBlockedQueues) { @@ -422,12 +427,13 @@ // Removing the second queue and selecting again should result in another // notification. + task_queue->UnregisterTaskQueue(); selector.RemoveQueue(task_queue.get()); EXPECT_CALL(mock_observer, OnTriedToSelectBlockedWorkQueue(_)).Times(1); EXPECT_FALSE(selector.SelectWorkQueueToService(&chosen_work_queue)); - task_queue->UnregisterTaskQueue(); task_queue2->UnregisterTaskQueue(); + selector.RemoveQueue(task_queue2.get()); } struct ChooseOldestWithPriorityTestParam {
diff --git a/components/scheduler/base/work_queue.cc b/components/scheduler/base/work_queue.cc index 6051a49..338c0b1e 100644 --- a/components/scheduler/base/work_queue.cc +++ b/components/scheduler/base/work_queue.cc
@@ -23,10 +23,9 @@ } } -WorkQueue::~WorkQueue() {} - -void WorkQueue::Clear() { - work_queue_ = std::queue<TaskQueueImpl::Task>(); +WorkQueue::~WorkQueue() { + DCHECK(!work_queue_sets_) << task_queue_ ->GetName() << " : " + << work_queue_sets_->name() << " : " << name_; } const TaskQueueImpl::Task* WorkQueue::GetFrontTask() const { @@ -43,21 +42,19 @@ } void WorkQueue::Push(TaskQueueImpl::Task&& task) { - DCHECK(work_queue_sets_); bool was_empty = work_queue_.empty(); work_queue_.push(task); - if (was_empty) + if (was_empty && work_queue_sets_) work_queue_sets_->OnPushQueue(this); } void WorkQueue::PushAndSetEnqueueOrder(TaskQueueImpl::Task&& task, EnqueueOrder enqueue_order) { - DCHECK(work_queue_sets_); bool was_empty = work_queue_.empty(); work_queue_.push(task); work_queue_.back().set_enqueue_order(enqueue_order); - if (was_empty) + if (was_empty && work_queue_sets_) work_queue_sets_->OnPushQueue(this); } @@ -66,10 +63,9 @@ } void WorkQueue::SwapLocked(std::queue<TaskQueueImpl::Task>& incoming_queue) { - DCHECK(work_queue_sets_); std::swap(work_queue_, incoming_queue); - if (!work_queue_.empty()) + if (!work_queue_.empty() && work_queue_sets_) work_queue_sets_->OnPushQueue(this); task_queue_->TraceQueueSize(true); } @@ -84,9 +80,11 @@ return pending_task; } -void WorkQueue::AssignToWorkQueueSets(WorkQueueSets* work_queue_sets, - size_t work_queue_set_index) { +void WorkQueue::AssignToWorkQueueSets(WorkQueueSets* work_queue_sets) { work_queue_sets_ = work_queue_sets; +} + +void WorkQueue::AssignSetIndex(size_t work_queue_set_index) { work_queue_set_index_ = work_queue_set_index; }
diff --git a/components/scheduler/base/work_queue.h b/components/scheduler/base/work_queue.h index 17a7a515..23845029 100644 --- a/components/scheduler/base/work_queue.h +++ b/components/scheduler/base/work_queue.h
@@ -26,8 +26,10 @@ // Associates this work queue with the given work queue sets. This must be // called before any tasks can be inserted into this work queue. - void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets, - size_t work_queue_set_index); + void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets); + + // Assigns the current set index. + void AssignSetIndex(size_t work_queue_set_index); void AsValueInto(base::trace_event::TracedValue* state) const;
diff --git a/components/scheduler/base/work_queue_sets.cc b/components/scheduler/base/work_queue_sets.cc index f952334..96c5da4 100644 --- a/components/scheduler/base/work_queue_sets.cc +++ b/components/scheduler/base/work_queue_sets.cc
@@ -10,15 +10,29 @@ namespace scheduler { namespace internal { -WorkQueueSets::WorkQueueSets(size_t num_sets) - : enqueue_order_to_work_queue_maps_(num_sets) {} +WorkQueueSets::WorkQueueSets(size_t num_sets, const char* name) + : enqueue_order_to_work_queue_maps_(num_sets), name_(name) {} WorkQueueSets::~WorkQueueSets() {} +void WorkQueueSets::AddQueue(WorkQueue* work_queue, size_t set_index) { + DCHECK(!work_queue->work_queue_sets()); + DCHECK_LT(set_index, enqueue_order_to_work_queue_maps_.size()); + EnqueueOrder enqueue_order; + bool has_enqueue_order = work_queue->GetFrontTaskEnqueueOrder(&enqueue_order); + work_queue->AssignToWorkQueueSets(this); + work_queue->AssignSetIndex(set_index); + if (!has_enqueue_order) + return; + enqueue_order_to_work_queue_maps_[set_index].insert( + std::make_pair(enqueue_order, work_queue)); +} + void WorkQueueSets::RemoveQueue(WorkQueue* work_queue) { DCHECK_EQ(this, work_queue->work_queue_sets()); EnqueueOrder enqueue_order; bool has_enqueue_order = work_queue->GetFrontTaskEnqueueOrder(&enqueue_order); + work_queue->AssignToWorkQueueSets(nullptr); if (!has_enqueue_order) return; size_t set_index = work_queue->work_queue_set_index(); @@ -29,13 +43,15 @@ enqueue_order_to_work_queue_maps_[set_index].erase(enqueue_order); } -void WorkQueueSets::AssignQueueToSet(WorkQueue* work_queue, size_t set_index) { +void WorkQueueSets::ChangeSetIndex(WorkQueue* work_queue, size_t set_index) { + DCHECK_EQ(this, work_queue->work_queue_sets()); DCHECK_LT(set_index, enqueue_order_to_work_queue_maps_.size()); EnqueueOrder enqueue_order; bool has_enqueue_order = work_queue->GetFrontTaskEnqueueOrder(&enqueue_order); size_t old_set = work_queue->work_queue_set_index(); DCHECK_LT(old_set, enqueue_order_to_work_queue_maps_.size()); - work_queue->AssignToWorkQueueSets(this, set_index); + DCHECK_NE(old_set, set_index); + work_queue->AssignSetIndex(set_index); if (!has_enqueue_order) return; enqueue_order_to_work_queue_maps_[old_set].erase(enqueue_order); @@ -44,6 +60,8 @@ } void WorkQueueSets::OnPushQueue(WorkQueue* work_queue) { + // NOTE if this funciton changes, we need to keep |WorkQueueSets::AddQueue| in + // sync. DCHECK_EQ(this, work_queue->work_queue_sets()); EnqueueOrder enqueue_order; bool has_enqueue_order = work_queue->GetFrontTaskEnqueueOrder(&enqueue_order); @@ -98,7 +116,8 @@ } #if DCHECK_IS_ON() || !defined(NDEBUG) -bool WorkQueueSets::ContainsWorkQueueForTest(WorkQueue* work_queue) const { +bool WorkQueueSets::ContainsWorkQueueForTest( + const WorkQueue* work_queue) const { EnqueueOrder enqueue_order; bool has_enqueue_order = work_queue->GetFrontTaskEnqueueOrder(&enqueue_order); @@ -114,6 +133,11 @@ } } + if (work_queue->work_queue_sets() == this) { + DCHECK(!has_enqueue_order); + return true; + } + return false; } #endif
diff --git a/components/scheduler/base/work_queue_sets.h b/components/scheduler/base/work_queue_sets.h index 7dd451a3..0c2c2dcf 100644 --- a/components/scheduler/base/work_queue_sets.h +++ b/components/scheduler/base/work_queue_sets.h
@@ -22,14 +22,17 @@ class SCHEDULER_EXPORT WorkQueueSets { public: - explicit WorkQueueSets(size_t num_sets); + WorkQueueSets(size_t num_sets, const char* name); ~WorkQueueSets(); // O(log num queues) + void AddQueue(WorkQueue* queue, size_t set_index); + + // O(log num queues) void RemoveQueue(WorkQueue* work_queue); // O(log num queues) - void AssignQueueToSet(WorkQueue* queue, size_t set_index); + void ChangeSetIndex(WorkQueue* queue, size_t set_index); // O(log num queues) void OnPushQueue(WorkQueue* work_queue); @@ -46,12 +49,15 @@ #if DCHECK_IS_ON() || !defined(NDEBUG) // Note this iterates over everything in |enqueue_order_to_work_queue_maps_|. // It's intended for use with DCHECKS and for testing - bool ContainsWorkQueueForTest(WorkQueue* queue) const; + bool ContainsWorkQueueForTest(const WorkQueue* queue) const; #endif + const char* name() const { return name_; } + private: typedef std::map<EnqueueOrder, WorkQueue*> EnqueueOrderToWorkQueueMap; std::vector<EnqueueOrderToWorkQueueMap> enqueue_order_to_work_queue_maps_; + const char* name_; DISALLOW_COPY_AND_ASSIGN(WorkQueueSets); };
diff --git a/components/scheduler/base/work_queue_sets_unittest.cc b/components/scheduler/base/work_queue_sets_unittest.cc index efbdef0..4ffefdef 100644 --- a/components/scheduler/base/work_queue_sets_unittest.cc +++ b/components/scheduler/base/work_queue_sets_unittest.cc
@@ -16,7 +16,16 @@ class WorkQueueSetsTest : public testing::Test { public: - void SetUp() override { work_queue_sets_.reset(new WorkQueueSets(kNumSets)); } + void SetUp() override { + work_queue_sets_.reset(new WorkQueueSets(kNumSets, "test")); + } + + void TearDown() override { + for (scoped_ptr<WorkQueue>& work_queue : work_queues_) { + if (work_queue->work_queue_sets()) + work_queue_sets_->RemoveQueue(work_queue.get()); + } + } protected: enum { @@ -26,7 +35,7 @@ WorkQueue* NewTaskQueue(const char* queue_name) { WorkQueue* queue = new WorkQueue(nullptr, "test"); work_queues_.push_back(make_scoped_ptr(queue)); - work_queue_sets_->AssignQueueToSet(queue, TaskQueue::CONTROL_PRIORITY); + work_queue_sets_->AddQueue(queue, TaskQueue::CONTROL_PRIORITY); return queue; } @@ -41,10 +50,10 @@ scoped_ptr<WorkQueueSets> work_queue_sets_; }; -TEST_F(WorkQueueSetsTest, AssignQueueToSet) { +TEST_F(WorkQueueSetsTest, ChangeSetIndex) { WorkQueue* work_queue = NewTaskQueue("queue"); size_t set = TaskQueue::NORMAL_PRIORITY; - work_queue_sets_->AssignQueueToSet(work_queue, set); + work_queue_sets_->ChangeSetIndex(work_queue, set); EXPECT_EQ(set, work_queue->work_queue_set_index()); } @@ -52,7 +61,7 @@ TEST_F(WorkQueueSetsTest, GetOldestQueueInSet_QueueEmpty) { WorkQueue* work_queue = NewTaskQueue("queue"); size_t set = TaskQueue::NORMAL_PRIORITY; - work_queue_sets_->AssignQueueToSet(work_queue, set); + work_queue_sets_->ChangeSetIndex(work_queue, set); WorkQueue* selected_work_queue; EXPECT_FALSE( @@ -62,7 +71,7 @@ TEST_F(WorkQueueSetsTest, OnPushQueue) { WorkQueue* work_queue = NewTaskQueue("queue"); size_t set = TaskQueue::NORMAL_PRIORITY; - work_queue_sets_->AssignQueueToSet(work_queue, set); + work_queue_sets_->ChangeSetIndex(work_queue, set); WorkQueue* selected_work_queue; EXPECT_FALSE( @@ -79,7 +88,7 @@ WorkQueue* work_queue = NewTaskQueue("queue"); work_queue->Push(FakeTaskWithEnqueueOrder(10)); size_t set = 1; - work_queue_sets_->AssignQueueToSet(work_queue, set); + work_queue_sets_->ChangeSetIndex(work_queue, set); WorkQueue* selected_work_queue; EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); @@ -94,9 +103,9 @@ queue2->Push(FakeTaskWithEnqueueOrder(5)); queue3->Push(FakeTaskWithEnqueueOrder(4)); size_t set = 2; - work_queue_sets_->AssignQueueToSet(queue1, set); - work_queue_sets_->AssignQueueToSet(queue2, set); - work_queue_sets_->AssignQueueToSet(queue3, set); + work_queue_sets_->ChangeSetIndex(queue1, set); + work_queue_sets_->ChangeSetIndex(queue2, set); + work_queue_sets_->ChangeSetIndex(queue3, set); WorkQueue* selected_work_queue; EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); @@ -112,9 +121,9 @@ queue2->Push(FakeTaskWithEnqueueOrder(1)); queue3->Push(FakeTaskWithEnqueueOrder(4)); size_t set = 3; - work_queue_sets_->AssignQueueToSet(queue1, set); - work_queue_sets_->AssignQueueToSet(queue2, set); - work_queue_sets_->AssignQueueToSet(queue3, set); + work_queue_sets_->ChangeSetIndex(queue1, set); + work_queue_sets_->ChangeSetIndex(queue2, set); + work_queue_sets_->ChangeSetIndex(queue3, set); WorkQueue* selected_work_queue; EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); @@ -135,9 +144,9 @@ queue2->Push(FakeTaskWithEnqueueOrder(5)); queue3->Push(FakeTaskWithEnqueueOrder(4)); size_t set = 4; - work_queue_sets_->AssignQueueToSet(queue1, set); - work_queue_sets_->AssignQueueToSet(queue2, set); - work_queue_sets_->AssignQueueToSet(queue3, set); + work_queue_sets_->ChangeSetIndex(queue1, set); + work_queue_sets_->ChangeSetIndex(queue2, set); + work_queue_sets_->ChangeSetIndex(queue3, set); WorkQueue* selected_work_queue; EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); @@ -158,10 +167,10 @@ queue1->Push(FakeTaskWithEnqueueOrder(0x7ffffff1)); queue2->Push(FakeTaskWithEnqueueOrder(0x7ffffff0)); queue3->Push(FakeTaskWithEnqueueOrder(-0x7ffffff1)); - size_t set = 0; - work_queue_sets_->AssignQueueToSet(queue1, set); - work_queue_sets_->AssignQueueToSet(queue2, set); - work_queue_sets_->AssignQueueToSet(queue3, set); + size_t set = 1; + work_queue_sets_->ChangeSetIndex(queue1, set); + work_queue_sets_->ChangeSetIndex(queue2, set); + work_queue_sets_->ChangeSetIndex(queue3, set); WorkQueue* selected_work_queue; EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); @@ -176,9 +185,9 @@ queue2->Push(FakeTaskWithEnqueueOrder(5)); queue3->Push(FakeTaskWithEnqueueOrder(4)); size_t set = 1; - work_queue_sets_->AssignQueueToSet(queue1, set); - work_queue_sets_->AssignQueueToSet(queue2, set); - work_queue_sets_->AssignQueueToSet(queue3, set); + work_queue_sets_->ChangeSetIndex(queue1, set); + work_queue_sets_->ChangeSetIndex(queue2, set); + work_queue_sets_->ChangeSetIndex(queue3, set); work_queue_sets_->RemoveQueue(queue3); WorkQueue* selected_work_queue; @@ -186,7 +195,7 @@ EXPECT_EQ(queue2, selected_work_queue); } -TEST_F(WorkQueueSetsTest, AssignQueueToSet_Complex) { +TEST_F(WorkQueueSetsTest, ChangeSetIndex_Complex) { WorkQueue* queue1 = NewTaskQueue("queue1"); WorkQueue* queue2 = NewTaskQueue("queue2"); WorkQueue* queue3 = NewTaskQueue("queue3"); @@ -197,10 +206,10 @@ queue4->Push(FakeTaskWithEnqueueOrder(3)); size_t set1 = 1; size_t set2 = 2; - work_queue_sets_->AssignQueueToSet(queue1, set1); - work_queue_sets_->AssignQueueToSet(queue2, set1); - work_queue_sets_->AssignQueueToSet(queue3, set2); - work_queue_sets_->AssignQueueToSet(queue4, set2); + work_queue_sets_->ChangeSetIndex(queue1, set1); + work_queue_sets_->ChangeSetIndex(queue2, set1); + work_queue_sets_->ChangeSetIndex(queue3, set2); + work_queue_sets_->ChangeSetIndex(queue4, set2); WorkQueue* selected_work_queue; EXPECT_TRUE( @@ -211,7 +220,7 @@ work_queue_sets_->GetOldestQueueInSet(set2, &selected_work_queue)); EXPECT_EQ(queue4, selected_work_queue); - work_queue_sets_->AssignQueueToSet(queue4, set1); + work_queue_sets_->ChangeSetIndex(queue4, set1); EXPECT_TRUE( work_queue_sets_->GetOldestQueueInSet(set1, &selected_work_queue)); @@ -223,21 +232,21 @@ } TEST_F(WorkQueueSetsTest, IsSetEmpty_NoWork) { - size_t set = 0; + size_t set = 2; EXPECT_TRUE(work_queue_sets_->IsSetEmpty(set)); WorkQueue* work_queue = NewTaskQueue("queue"); - work_queue_sets_->AssignQueueToSet(work_queue, set); + work_queue_sets_->ChangeSetIndex(work_queue, set); EXPECT_TRUE(work_queue_sets_->IsSetEmpty(set)); } TEST_F(WorkQueueSetsTest, IsSetEmpty_Work) { - size_t set = 0; + size_t set = 2; EXPECT_TRUE(work_queue_sets_->IsSetEmpty(set)); WorkQueue* work_queue = NewTaskQueue("queue"); work_queue->Push(FakeTaskWithEnqueueOrder(1)); - work_queue_sets_->AssignQueueToSet(work_queue, set); + work_queue_sets_->ChangeSetIndex(work_queue, set); EXPECT_FALSE(work_queue_sets_->IsSetEmpty(set)); work_queue->PopTaskForTest();
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc index f0d76ed..e11a915 100644 --- a/components/tracing/child_trace_message_filter.cc +++ b/components/tracing/child_trace_message_filter.cc
@@ -50,10 +50,6 @@ IPC_MESSAGE_HANDLER(TracingMsg_BeginTracing, OnBeginTracing) IPC_MESSAGE_HANDLER(TracingMsg_EndTracing, OnEndTracing) IPC_MESSAGE_HANDLER(TracingMsg_CancelTracing, OnCancelTracing) - IPC_MESSAGE_HANDLER(TracingMsg_StartMonitoring, OnStartMonitoring) - IPC_MESSAGE_HANDLER(TracingMsg_StopMonitoring, OnStopMonitoring) - IPC_MESSAGE_HANDLER(TracingMsg_CaptureMonitoringSnapshot, - OnCaptureMonitoringSnapshot) IPC_MESSAGE_HANDLER(TracingMsg_GetTraceLogStatus, OnGetTraceLogStatus) IPC_MESSAGE_HANDLER(TracingMsg_SetWatchEvent, OnSetWatchEvent) IPC_MESSAGE_HANDLER(TracingMsg_CancelWatchEvent, OnCancelWatchEvent) @@ -107,28 +103,6 @@ base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this)); } -void ChildTraceMessageFilter::OnStartMonitoring( - const std::string& trace_config_str, base::TimeTicks browser_time) { - TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(trace_config_str), - base::trace_event::TraceLog::MONITORING_MODE); -} - -void ChildTraceMessageFilter::OnStopMonitoring() { - TraceLog::GetInstance()->SetDisabled(); -} - -void ChildTraceMessageFilter::OnCaptureMonitoringSnapshot() { - // Flush will generate one or more callbacks to - // OnMonitoringTraceDataCollected. It's important that the last - // OnMonitoringTraceDataCollected gets called before - // CaptureMonitoringSnapshotAck below. We are already on the IO thread, - // so the OnMonitoringTraceDataCollected calls will not be deferred. - TraceLog::GetInstance()->FlushButLeaveBufferIntact( - base::Bind(&ChildTraceMessageFilter::OnMonitoringTraceDataCollected, - this)); -} - void ChildTraceMessageFilter::OnGetTraceLogStatus() { sender_->Send(new TracingHostMsg_TraceLogStatusReply( TraceLog::GetInstance()->GetStatus())); @@ -175,23 +149,6 @@ } } -void ChildTraceMessageFilter::OnMonitoringTraceDataCollected( - const scoped_refptr<base::RefCountedString>& events_str_ptr, - bool has_more_events) { - if (!ipc_task_runner_->BelongsToCurrentThread()) { - ipc_task_runner_->PostTask( - FROM_HERE, - base::Bind(&ChildTraceMessageFilter::OnMonitoringTraceDataCollected, - this, events_str_ptr, has_more_events)); - return; - } - sender_->Send(new TracingHostMsg_MonitoringTraceDataCollected( - events_str_ptr->data())); - - if (!has_more_events) - sender_->Send(new TracingHostMsg_CaptureMonitoringSnapshotAck()); -} - // Sent by the Browser's MemoryDumpManager when coordinating a global dump. void ChildTraceMessageFilter::OnProcessMemoryDumpRequest( const base::trace_event::MemoryDumpRequestArgs& args) {
diff --git a/components/tracing/child_trace_message_filter.h b/components/tracing/child_trace_message_filter.h index 4a9cfc5..33d210a 100644 --- a/components/tracing/child_trace_message_filter.h +++ b/components/tracing/child_trace_message_filter.h
@@ -53,10 +53,6 @@ uint64_t tracing_process_id); void OnEndTracing(); void OnCancelTracing(); - void OnStartMonitoring(const std::string& trace_config_str, - base::TimeTicks browser_time); - void OnStopMonitoring(); - void OnCaptureMonitoringSnapshot(); void OnGetTraceLogStatus(); void OnSetWatchEvent(const std::string& category_name, const std::string& event_name); @@ -83,10 +79,6 @@ const scoped_refptr<base::RefCountedString>& events_str_ptr, bool has_more_events); - void OnMonitoringTraceDataCollected( - const scoped_refptr<base::RefCountedString>& events_str_ptr, - bool has_more_events); - void OnProcessMemoryDumpDone(uint64_t dump_guid, bool success); void SetSenderForTesting(IPC::Sender* sender);
diff --git a/components/tracing/tracing_messages.h b/components/tracing/tracing_messages.h index 47592beb..470339a9 100644 --- a/components/tracing/tracing_messages.h +++ b/components/tracing/tracing_messages.h
@@ -57,17 +57,6 @@ // Sent to all child processes to cancel trace event recording. IPC_MESSAGE_CONTROL0(TracingMsg_CancelTracing) -// Sent to all child processes to start monitoring. -IPC_MESSAGE_CONTROL2(TracingMsg_StartMonitoring, - std::string /* trace_config_str */, - base::TimeTicks /* browser_time */) - -// Sent to all child processes to stop monitoring. -IPC_MESSAGE_CONTROL0(TracingMsg_StopMonitoring) - -// Sent to all child processes to capture the current monitorint snapshot. -IPC_MESSAGE_CONTROL0(TracingMsg_CaptureMonitoringSnapshot) - // Sent to all child processes to get trace buffer fullness. IPC_MESSAGE_CONTROL0(TracingMsg_GetTraceLogStatus) @@ -108,18 +97,10 @@ IPC_MESSAGE_CONTROL1(TracingHostMsg_EndTracingAck, std::vector<std::string> /* known_categories */) -// Reply from child processes acking TracingMsg_CaptureMonitoringSnapshot. -IPC_MESSAGE_CONTROL0(TracingHostMsg_CaptureMonitoringSnapshotAck) - // Child processes send back trace data in JSON chunks. IPC_MESSAGE_CONTROL1(TracingHostMsg_TraceDataCollected, std::string /*json trace data*/) -// Child processes send back trace data of the current monitoring -// in JSON chunks. -IPC_MESSAGE_CONTROL1(TracingHostMsg_MonitoringTraceDataCollected, - std::string /*json trace data*/) - // Reply to TracingMsg_GetTraceLogStatus. IPC_MESSAGE_CONTROL1( TracingHostMsg_TraceLogStatusReply,
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index e8d31b073..59efad3 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc
@@ -142,6 +142,16 @@ g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; #endif // !OS_IOS && !CHROME_MULTIPLE_DLL_BROWSER +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) && defined(OS_ANDROID) +#if defined __LP64__ +#define kV8NativesDataDescriptor kV8NativesDataDescriptor64 +#define kV8SnapshotDataDescriptor kV8SnapshotDataDescriptor64 +#else +#define kV8NativesDataDescriptor kV8NativesDataDescriptor32 +#define kV8SnapshotDataDescriptor kV8SnapshotDataDescriptor32 +#endif +#endif + #if defined(OS_POSIX) && !defined(OS_IOS) // Setup signal-handling state: resanitize most signals, ignore SIGPIPE.
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index 4398e2b3..e92554c 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc
@@ -156,6 +156,31 @@ #endif ); #if defined(V8_USE_EXTERNAL_STARTUP_DATA) + bool snapshot_loaded = false; +#if defined(OS_ANDROID) + base::MemoryMappedFile::Region region; + auto maybe_register = [®ion, ®ions, &files_to_register](int key, + int fd) { + if (fd != -1) { + files_to_register->Share(key, fd); + regions.insert(std::make_pair(key, region)); + } + }; + maybe_register( + kV8NativesDataDescriptor32, + gin::V8Initializer::GetOpenNativesFileForChildProcesses(®ion, true)); + maybe_register( + kV8NativesDataDescriptor64, + gin::V8Initializer::GetOpenNativesFileForChildProcesses(®ion, false)); + maybe_register( + kV8SnapshotDataDescriptor32, + gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(®ion, true)); + maybe_register( + kV8SnapshotDataDescriptor64, + gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(®ion, false)); + + snapshot_loaded = true; +#else base::PlatformFile natives_pf = gin::V8Initializer::GetOpenNativesFileForChildProcesses( ®ions[kV8NativesDataDescriptor]); @@ -169,13 +194,15 @@ // Failure to load the V8 snapshot is not necessarily an error. V8 can start // up (slower) without the snapshot. if (snapshot_pf != -1) { + snapshot_loaded = true; files_to_register->Share(kV8SnapshotDataDescriptor, snapshot_pf); regions.insert(std::make_pair(kV8SnapshotDataDescriptor, snapshot_region)); } +#endif if (process_type != switches::kZygoteProcess) { cmd_line->AppendSwitch(::switches::kV8NativesPassedByFD); - if (snapshot_pf != -1) { + if (snapshot_loaded) { cmd_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); } }
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc index 1fb3bfd..4a37ef5 100644 --- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -35,6 +35,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/bindings_policy.h" +#include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/content_switches.h" #include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_params.h" @@ -2450,21 +2451,34 @@ WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( shell()->web_contents()); - RenderFrameHostImpl* pending_rfh = - web_contents->GetRenderManagerForTesting()->pending_frame_host(); - ASSERT_TRUE(pending_rfh); + RenderFrameHostImpl* next_rfh = + IsBrowserSideNavigationEnabled() + ? web_contents->GetRenderManagerForTesting()->speculative_frame_host() + : web_contents->GetRenderManagerForTesting()->pending_frame_host(); + ASSERT_TRUE(next_rfh); // Navigate to the same new site and verify that we commit in the same RFH. GURL cross_site_url2(embedded_test_server()->GetURL("b.com", "/title2.html")); TestNavigationObserver navigation_observer(web_contents, 1); shell()->LoadURL(cross_site_url2); - EXPECT_EQ(pending_rfh, - web_contents->GetRenderManagerForTesting()->pending_frame_host()); + if (IsBrowserSideNavigationEnabled()) { + EXPECT_EQ( + next_rfh, + web_contents->GetRenderManagerForTesting()->speculative_frame_host()); + } else { + EXPECT_EQ(next_rfh, + web_contents->GetRenderManagerForTesting()->pending_frame_host()); + } navigation_observer.Wait(); EXPECT_EQ(cross_site_url2, web_contents->GetLastCommittedURL()); - EXPECT_EQ(pending_rfh, web_contents->GetMainFrame()); - EXPECT_FALSE( - web_contents->GetRenderManagerForTesting()->pending_frame_host()); + EXPECT_EQ(next_rfh, web_contents->GetMainFrame()); + if (IsBrowserSideNavigationEnabled()) { + EXPECT_FALSE( + web_contents->GetRenderManagerForTesting()->speculative_frame_host()); + } else { + EXPECT_FALSE( + web_contents->GetRenderManagerForTesting()->pending_frame_host()); + } ResourceDispatcherHost::Get()->SetDelegate(nullptr); }
diff --git a/content/browser/mojo/mojo_app_connection_impl.cc b/content/browser/mojo/mojo_app_connection_impl.cc index 7b0aa7c..cf8d1c2 100644 --- a/content/browser/mojo/mojo_app_connection_impl.cc +++ b/content/browser/mojo/mojo_app_connection_impl.cc
@@ -30,7 +30,7 @@ MojoAppConnectionImpl::MojoAppConnectionImpl(const GURL& url, const GURL& requestor_url) { MojoShellContext::ConnectToApplication( - url, requestor_url, mojo::GetProxy(&services_), + url, requestor_url, mojo::GetProxy(&interfaces_), mojo::InterfaceProviderPtr(), mojo::shell::GetPermissiveCapabilityFilter(), base::Bind(&OnGotRemoteIDs)); @@ -39,10 +39,10 @@ MojoAppConnectionImpl::~MojoAppConnectionImpl() { } -void MojoAppConnectionImpl::ConnectToService( - const std::string& service_name, +void MojoAppConnectionImpl::GetInterface( + const std::string& interface_name, mojo::ScopedMessagePipeHandle handle) { - services_->GetInterface(service_name, std::move(handle)); + interfaces_->GetInterface(interface_name, std::move(handle)); } } // namespace content
diff --git a/content/browser/mojo/mojo_app_connection_impl.h b/content/browser/mojo/mojo_app_connection_impl.h index 0cef208..efccbd1a8 100644 --- a/content/browser/mojo/mojo_app_connection_impl.h +++ b/content/browser/mojo/mojo_app_connection_impl.h
@@ -21,10 +21,10 @@ private: // MojoAppConnection: - void ConnectToService(const std::string& service_name, - mojo::ScopedMessagePipeHandle handle) override; + void GetInterface(const std::string& interface_name, + mojo::ScopedMessagePipeHandle handle) override; - mojo::InterfaceProviderPtr services_; + mojo::InterfaceProviderPtr interfaces_; DISALLOW_COPY_AND_ASSIGN(MojoAppConnectionImpl); };
diff --git a/content/browser/mojo/mojo_shell_client_host.cc b/content/browser/mojo/mojo_shell_client_host.cc index 2d3b208..86a6737e 100644 --- a/content/browser/mojo/mojo_shell_client_host.cc +++ b/content/browser/mojo/mojo_shell_client_host.cc
@@ -133,7 +133,7 @@ mojo::edk::CreateMessagePipe(std::move(parent_pipe)); mojo::shell::mojom::ApplicationManagerPtr application_manager; - MojoShellConnection::Get()->GetShell()->ConnectToService( + MojoShellConnection::Get()->GetShell()->ConnectToInterface( "mojo:shell", &application_manager); // The content of the URL/qualifier we pass is actually meaningless, it's only
diff --git a/content/browser/mojo_shell_browsertest.cc b/content/browser/mojo_shell_browsertest.cc index 75a263c..6f16b03f 100644 --- a/content/browser/mojo_shell_browsertest.cc +++ b/content/browser/mojo_shell_browsertest.cc
@@ -38,7 +38,7 @@ auto test_app = MojoAppConnection::Create(GURL(kInProcessTestMojoAppUrl), GURL(kBrowserMojoAppUrl)); TestMojoServicePtr test_service; - test_app->ConnectToService(&test_service); + test_app->GetInterface(&test_service); base::RunLoop run_loop; test_service->DoSomething(run_loop.QuitClosure()); @@ -52,7 +52,7 @@ auto test_app = MojoAppConnection::Create(GURL(kTestMojoAppUrl), GURL(kBrowserMojoAppUrl)); TestMojoServicePtr test_service; - test_app->ConnectToService(&test_service); + test_app->GetInterface(&test_service); base::RunLoop run_loop; test_service->DoSomething(run_loop.QuitClosure());
diff --git a/content/browser/notifications/notification_database_data.proto b/content/browser/notifications/notification_database_data.proto index 1762078..8320e6e 100644 --- a/content/browser/notifications/notification_database_data.proto +++ b/content/browser/notifications/notification_database_data.proto
@@ -20,10 +20,11 @@ // A notification action, corresponds to content::PlatformNotificationAction. // - // Next tag: 3 + // Next tag: 4 message NotificationAction { optional string action = 1; optional string title = 2; + optional string icon = 3; } // Actual data payload of the notification. This message is the protocol
diff --git a/content/browser/notifications/notification_database_data_conversions.cc b/content/browser/notifications/notification_database_data_conversions.cc index 8621fc13..9487209 100644 --- a/content/browser/notifications/notification_database_data_conversions.cc +++ b/content/browser/notifications/notification_database_data_conversions.cc
@@ -71,6 +71,7 @@ PlatformNotificationAction action; action.action = payload_action.action(); action.title = base::UTF8ToUTF16(payload_action.title()); + action.icon = GURL(payload_action.icon()); notification_data->actions.push_back(action); } @@ -125,6 +126,7 @@ payload->add_actions(); payload_action->set_action(action.action); payload_action->set_title(base::UTF16ToUTF8(action.title)); + payload_action->set_icon(action.icon.spec()); } NotificationDatabaseDataProto message;
diff --git a/content/browser/notifications/notification_database_data_unittest.cc b/content/browser/notifications/notification_database_data_unittest.cc index 4765dba..d842205 100644 --- a/content/browser/notifications/notification_database_data_unittest.cc +++ b/content/browser/notifications/notification_database_data_unittest.cc
@@ -27,6 +27,7 @@ const char kNotificationBody[] = "Hello, world!"; const char kNotificationTag[] = "my_tag"; const char kNotificationIconUrl[] = "https://example.com/icon.png"; +const char kNotificationActionIconUrl[] = "https://example.com/action_icon.png"; const int kNotificationVibrationPattern[] = {100, 200, 300}; const double kNotificationTimestamp = 621046800.; const unsigned char kNotificationData[] = {0xdf, 0xff, 0x0, 0x0, 0xff, 0xdf}; @@ -56,6 +57,7 @@ PlatformNotificationAction notification_action; notification_action.action = base::SizeTToString(i); notification_action.title = base::SizeTToString16(i); + notification_action.icon = GURL(kNotificationActionIconUrl); notification_data.actions.push_back(notification_action); } @@ -111,6 +113,8 @@ copied_notification_data.actions[i].action); EXPECT_EQ(notification_data.actions[i].title, copied_notification_data.actions[i].title); + EXPECT_EQ(notification_data.actions[i].icon, + copied_notification_data.actions[i].icon); } }
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc index 5ef8d43..ca96329 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -761,7 +761,10 @@ const OutputDeviceAccessCB& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( + // Check security origin if nondefault device is requested. + // Ignore check for default device, which is always authorized. + if (!IsDefaultDeviceId(device_id) && + !ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( render_process_id_, gurl_security_origin)) { content::bad_message::ReceivedBadMessage(this, bad_message::ARH_UNAUTHORIZED_URL);
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 4a714dc..6479992 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1393,6 +1393,7 @@ switches::kDisableEncryptedMedia, switches::kDisableFileSystem, switches::kDisableGestureRequirementForMediaPlayback, + switches::kDisableGestureRequirementForPresentation, switches::kDisableGpuCompositing, switches::kDisableGpuMemoryBufferVideoFrames, switches::kDisableGpuVsync,
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 69aa978..5aa3313f 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -527,6 +527,9 @@ prefs.v8_cache_options = GetV8CacheOptions(); + prefs.user_gesture_required_for_presentation = !command_line.HasSwitch( + switches::kDisableGestureRequirementForPresentation); + GetContentClient()->browser()->OverrideWebkitPrefs(this, &prefs); return prefs; }
diff --git a/content/browser/renderer_host/render_widget_host_view_mus.cc b/content/browser/renderer_host/render_widget_host_view_mus.cc index 7f74642..4bd3d57 100644 --- a/content/browser/renderer_host/render_widget_host_view_mus.cc +++ b/content/browser/renderer_host/render_widget_host_view_mus.cc
@@ -40,7 +40,7 @@ // and embed that client inside our mus window. std::string url = GetMojoApplicationInstanceURL(host_->GetProcess()); mojom::RenderWidgetWindowTreeClientFactoryPtr factory; - MojoShellConnection::Get()->GetShell()->ConnectToService(url, &factory); + MojoShellConnection::Get()->GetShell()->ConnectToInterface(url, &factory); mus::mojom::WindowTreeClientPtr window_tree_client; factory->CreateWindowTreeClientForRenderWidget(
diff --git a/content/browser/tracing/trace_message_filter.cc b/content/browser/tracing/trace_message_filter.cc index 45cb702..d9168e7 100644 --- a/content/browser/tracing/trace_message_filter.cc +++ b/content/browser/tracing/trace_message_filter.cc
@@ -18,7 +18,6 @@ ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( child_process_id)), is_awaiting_end_ack_(false), - is_awaiting_capture_monitoring_snapshot_ack_(false), is_awaiting_buffer_percent_full_ack_(false) { } @@ -29,9 +28,6 @@ if (is_awaiting_end_ack_) OnEndTracingAck(std::vector<std::string>()); - if (is_awaiting_capture_monitoring_snapshot_ack_) - OnCaptureMonitoringSnapshotAcked(); - if (is_awaiting_buffer_percent_full_ack_) OnTraceLogStatusReply(base::trace_event::TraceLogStatus()); @@ -46,12 +42,8 @@ IPC_MESSAGE_HANDLER(TracingHostMsg_ChildSupportsTracing, OnChildSupportsTracing) IPC_MESSAGE_HANDLER(TracingHostMsg_EndTracingAck, OnEndTracingAck) - IPC_MESSAGE_HANDLER(TracingHostMsg_CaptureMonitoringSnapshotAck, - OnCaptureMonitoringSnapshotAcked) IPC_MESSAGE_HANDLER(TracingHostMsg_TraceDataCollected, OnTraceDataCollected) - IPC_MESSAGE_HANDLER(TracingHostMsg_MonitoringTraceDataCollected, - OnMonitoringTraceDataCollected) IPC_MESSAGE_HANDLER(TracingHostMsg_WatchEventMatched, OnWatchEventMatched) IPC_MESSAGE_HANDLER(TracingHostMsg_TraceLogStatusReply, @@ -90,25 +82,6 @@ Send(new TracingMsg_CancelTracing); } -void TraceMessageFilter::SendStartMonitoring( - const base::trace_event::TraceConfig& trace_config) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - Send(new TracingMsg_StartMonitoring(trace_config.ToString(), - base::TimeTicks::Now())); -} - -void TraceMessageFilter::SendStopMonitoring() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - Send(new TracingMsg_StopMonitoring); -} - -void TraceMessageFilter::SendCaptureMonitoringSnapshot() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(!is_awaiting_capture_monitoring_snapshot_ack_); - is_awaiting_capture_monitoring_snapshot_ack_ = true; - Send(new TracingMsg_CaptureMonitoringSnapshot); -} - void TraceMessageFilter::SendGetTraceLogStatus() { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!is_awaiting_buffer_percent_full_ack_); @@ -155,32 +128,12 @@ } } -void TraceMessageFilter::OnCaptureMonitoringSnapshotAcked() { - // is_awaiting_capture_monitoring_snapshot_ack_ should always be true here, - // but check in case the child process is compromised. - if (is_awaiting_capture_monitoring_snapshot_ack_) { - is_awaiting_capture_monitoring_snapshot_ack_ = false; - TracingControllerImpl::GetInstance()->OnCaptureMonitoringSnapshotAcked( - this); - } else { - NOTREACHED(); - } -} - void TraceMessageFilter::OnTraceDataCollected(const std::string& data) { scoped_refptr<base::RefCountedString> data_ptr(new base::RefCountedString()); data_ptr->data() = data; TracingControllerImpl::GetInstance()->OnTraceDataCollected(data_ptr); } -void TraceMessageFilter::OnMonitoringTraceDataCollected( - const std::string& data) { - scoped_refptr<base::RefCountedString> data_ptr(new base::RefCountedString()); - data_ptr->data() = data; - TracingControllerImpl::GetInstance()->OnMonitoringTraceDataCollected( - data_ptr); -} - void TraceMessageFilter::OnWatchEventMatched() { TracingControllerImpl::GetInstance()->OnWatchEventMatched(); }
diff --git a/content/browser/tracing/trace_message_filter.h b/content/browser/tracing/trace_message_filter.h index 22d91d9..94c435e 100644 --- a/content/browser/tracing/trace_message_filter.h +++ b/content/browser/tracing/trace_message_filter.h
@@ -32,10 +32,6 @@ const base::trace_event::TraceConfig& trace_config); void SendEndTracing(); void SendCancelTracing(); - void SendStartMonitoring( - const base::trace_event::TraceConfig& trace_config); - void SendStopMonitoring(); - void SendCaptureMonitoringSnapshot(); void SendGetTraceLogStatus(); void SendSetWatchEvent(const std::string& category_name, const std::string& event_name); @@ -50,11 +46,9 @@ // Message handlers. void OnChildSupportsTracing(); void OnEndTracingAck(const std::vector<std::string>& known_categories); - void OnCaptureMonitoringSnapshotAcked(); void OnWatchEventMatched(); void OnTraceLogStatusReply(const base::trace_event::TraceLogStatus& status); void OnTraceDataCollected(const std::string& data); - void OnMonitoringTraceDataCollected(const std::string& data); void OnGlobalMemoryDumpRequest( const base::trace_event::MemoryDumpRequestArgs& args); void OnProcessMemoryDumpResponse(uint64_t dump_guid, bool success); @@ -71,8 +65,6 @@ // Awaiting ack for previously sent SendEndTracing bool is_awaiting_end_ack_; - // Awaiting ack for previously sent SendCaptureMonitoringSnapshot - bool is_awaiting_capture_monitoring_snapshot_ack_; // Awaiting ack for previously sent SendGetTraceLogStatus bool is_awaiting_buffer_percent_full_ack_;
diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc index d4b8671..edb11c0 100644 --- a/content/browser/tracing/tracing_controller_browsertest.cc +++ b/content/browser/tracing/tracing_controller_browsertest.cc
@@ -99,9 +99,6 @@ get_categories_done_callback_count_ = 0; enable_recording_done_callback_count_ = 0; disable_recording_done_callback_count_ = 0; - enable_monitoring_done_callback_count_ = 0; - disable_monitoring_done_callback_count_ = 0; - capture_monitoring_snapshot_done_callback_count_ = 0; ContentBrowserTest::SetUp(); } @@ -145,28 +142,7 @@ last_actual_recording_file_path_ = file_path; } - void StartMonitoringDoneCallbackTest(base::Closure quit_callback) { - enable_monitoring_done_callback_count_++; - quit_callback.Run(); - } - - void StopMonitoringDoneCallbackTest(base::Closure quit_callback) { - disable_monitoring_done_callback_count_++; - quit_callback.Run(); - } - - void CaptureMonitoringSnapshotDoneCallbackTest( - base::Closure quit_callback, const base::FilePath& file_path) { - capture_monitoring_snapshot_done_callback_count_++; - EXPECT_TRUE(PathExists(file_path)); - int64_t file_size; - base::GetFileSize(file_path, &file_size); - EXPECT_TRUE(file_size > 0); - quit_callback.Run(); - last_actual_monitoring_file_path_ = file_path; - } - - int get_categories_done_callback_count() const { + int get_categories_done_callback_count() const { return get_categories_done_callback_count_; } @@ -178,26 +154,10 @@ return disable_recording_done_callback_count_; } - int enable_monitoring_done_callback_count() const { - return enable_monitoring_done_callback_count_; - } - - int disable_monitoring_done_callback_count() const { - return disable_monitoring_done_callback_count_; - } - - int capture_monitoring_snapshot_done_callback_count() const { - return capture_monitoring_snapshot_done_callback_count_; - } - base::FilePath last_actual_recording_file_path() const { return last_actual_recording_file_path_; } - base::FilePath last_actual_monitoring_file_path() const { - return last_actual_monitoring_file_path_; - } - const base::DictionaryValue* last_metadata() const { return last_metadata_.get(); } @@ -382,96 +342,11 @@ } } - void TestEnableCaptureAndStopMonitoring( - const base::FilePath& result_file_path) { - Navigate(shell()); - - TracingController* controller = TracingController::GetInstance(); - - { - bool is_monitoring; - TraceConfig trace_config("", ""); - controller->GetMonitoringStatus( - &is_monitoring, &trace_config); - EXPECT_FALSE(is_monitoring); - EXPECT_EQ("-*Debug,-*Test", trace_config.ToCategoryFilterString()); - EXPECT_FALSE(trace_config.GetTraceRecordMode() == RECORD_CONTINUOUSLY); - EXPECT_FALSE(trace_config.IsSamplingEnabled()); - EXPECT_FALSE(trace_config.IsSystraceEnabled()); - } - - { - base::RunLoop run_loop; - TracingController::StartMonitoringDoneCallback callback = - base::Bind(&TracingControllerTest::StartMonitoringDoneCallbackTest, - base::Unretained(this), - run_loop.QuitClosure()); - - TraceConfig trace_config("*", ""); - trace_config.EnableSampling(); - bool result = controller->StartMonitoring(trace_config, callback); - ASSERT_TRUE(result); - run_loop.Run(); - EXPECT_EQ(enable_monitoring_done_callback_count(), 1); - } - - { - bool is_monitoring; - TraceConfig trace_config("", ""); - controller->GetMonitoringStatus(&is_monitoring, &trace_config); - EXPECT_TRUE(is_monitoring); - EXPECT_EQ("*", trace_config.ToCategoryFilterString()); - EXPECT_FALSE(trace_config.GetTraceRecordMode() == RECORD_CONTINUOUSLY); - EXPECT_TRUE(trace_config.IsSamplingEnabled()); - EXPECT_FALSE(trace_config.IsSystraceEnabled()); - } - - { - base::RunLoop run_loop; - base::Closure callback = base::Bind( - &TracingControllerTest::CaptureMonitoringSnapshotDoneCallbackTest, - base::Unretained(this), - run_loop.QuitClosure(), - result_file_path); - ASSERT_TRUE(controller->CaptureMonitoringSnapshot( - TracingController::CreateFileSink(result_file_path, callback))); - run_loop.Run(); - EXPECT_EQ(capture_monitoring_snapshot_done_callback_count(), 1); - } - - { - base::RunLoop run_loop; - TracingController::StopMonitoringDoneCallback callback = - base::Bind(&TracingControllerTest::StopMonitoringDoneCallbackTest, - base::Unretained(this), - run_loop.QuitClosure()); - bool result = controller->StopMonitoring(callback); - ASSERT_TRUE(result); - run_loop.Run(); - EXPECT_EQ(disable_monitoring_done_callback_count(), 1); - } - - { - bool is_monitoring; - TraceConfig trace_config("", ""); - controller->GetMonitoringStatus(&is_monitoring, &trace_config); - EXPECT_FALSE(is_monitoring); - EXPECT_EQ("", trace_config.ToCategoryFilterString()); - EXPECT_FALSE(trace_config.GetTraceRecordMode() == RECORD_CONTINUOUSLY); - EXPECT_FALSE(trace_config.IsSamplingEnabled()); - EXPECT_FALSE(trace_config.IsSystraceEnabled()); - } - } - private: int get_categories_done_callback_count_; int enable_recording_done_callback_count_; int disable_recording_done_callback_count_; - int enable_monitoring_done_callback_count_; - int disable_monitoring_done_callback_count_; - int capture_monitoring_snapshot_done_callback_count_; base::FilePath last_actual_recording_file_path_; - base::FilePath last_actual_monitoring_file_path_; scoped_ptr<const base::DictionaryValue> last_metadata_; std::string last_data_; }; @@ -585,45 +460,4 @@ base::RunLoop().RunUntilIdle(); } -IN_PROC_BROWSER_TEST_F(TracingControllerTest, - EnableCaptureAndStopMonitoring) { - base::FilePath file_path; - base::CreateTemporaryFile(&file_path); - TestEnableCaptureAndStopMonitoring(file_path); -} - -IN_PROC_BROWSER_TEST_F(TracingControllerTest, - EnableCaptureAndStopMonitoringWithFilePath) { - base::FilePath file_path; - base::CreateTemporaryFile(&file_path); - TestEnableCaptureAndStopMonitoring(file_path); - EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value()); -} - -// See http://crbug.com/392446 -#if defined(OS_ANDROID) -#define MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback \ - DISABLED_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback -#else -#define MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback \ - EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback -#endif -IN_PROC_BROWSER_TEST_F( - TracingControllerTest, - MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback) { - Navigate(shell()); - - TracingController* controller = TracingController::GetInstance(); - TraceConfig trace_config("*", ""); - trace_config.EnableSampling(); - EXPECT_TRUE(controller->StartMonitoring( - trace_config, - TracingController::StartMonitoringDoneCallback())); - controller->CaptureMonitoringSnapshot(NULL); - base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(controller->StopMonitoring( - TracingController::StopMonitoringDoneCallback())); - base::RunLoop().RunUntilIdle(); -} - } // namespace content
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc index 9476d08..527e64c 100644 --- a/content/browser/tracing/tracing_controller_impl.cc +++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -160,15 +160,13 @@ TracingControllerImpl::TracingControllerImpl() : pending_start_tracing_ack_count_(0), pending_stop_tracing_ack_count_(0), - pending_capture_monitoring_snapshot_ack_count_(0), pending_trace_log_status_ack_count_(0), maximum_trace_buffer_usage_(0), approximate_event_count_(0), pending_memory_dump_ack_count_(0), failed_memory_dump_count_(0), pending_clock_sync_ack_count_(0), - is_tracing_(false), - is_monitoring_(false) { + is_tracing_(false) { base::trace_event::MemoryDumpManager::GetInstance()->Initialize( this /* delegate */, true /* is_coordinator */); @@ -388,134 +386,6 @@ StopAgentTracing(StopAgentTracingCallback()); } -bool TracingControllerImpl::StartMonitoring( - const TraceConfig& trace_config, - const StartMonitoringDoneCallback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - if (!can_start_monitoring()) - return false; - OnMonitoringStateChanged(true); - -#if defined(OS_ANDROID) - TraceLog::GetInstance()->AddClockSyncMetadataEvent(); -#endif - - base::Closure on_start_monitoring_done_callback = - base::Bind(&TracingControllerImpl::OnStartMonitoringDone, - base::Unretained(this), - trace_config, callback); - if (!BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, - base::Unretained(this), trace_config, - base::trace_event::TraceLog::MONITORING_MODE, - on_start_monitoring_done_callback))) { - // BrowserThread::PostTask fails if the threads haven't been created yet, - // so it should be safe to just use TraceLog::SetEnabled directly. - base::trace_event::TraceLog::GetInstance()->SetEnabled( - trace_config, base::trace_event::TraceLog::MONITORING_MODE); - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - on_start_monitoring_done_callback); - } - return true; -} - -void TracingControllerImpl::OnStartMonitoringDone( - const TraceConfig& trace_config, - const StartMonitoringDoneCallback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - // Notify all child processes. - for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendStartMonitoring(trace_config); - } - - if (!callback.is_null()) - callback.Run(); -} - -bool TracingControllerImpl::StopMonitoring( - const StopMonitoringDoneCallback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - if (!can_stop_monitoring()) - return false; - - base::Closure on_stop_monitoring_done_callback = - base::Bind(&TracingControllerImpl::OnStopMonitoringDone, - base::Unretained(this), callback); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - base::Bind(&TracingControllerImpl::SetDisabledOnFileThread, - base::Unretained(this), - on_stop_monitoring_done_callback)); - return true; -} - -void TracingControllerImpl::OnStopMonitoringDone( - const StopMonitoringDoneCallback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - OnMonitoringStateChanged(false); - - // Notify all child processes. - for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendStopMonitoring(); - } - if (!callback.is_null()) - callback.Run(); -} - -void TracingControllerImpl::GetMonitoringStatus( - bool* out_enabled, - TraceConfig* out_trace_config) { - *out_enabled = is_monitoring_; - *out_trace_config = TraceLog::GetInstance()->GetCurrentTraceConfig(); -} - -bool TracingControllerImpl::CaptureMonitoringSnapshot( - const scoped_refptr<TraceDataSink>& monitoring_data_sink) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - if (!can_stop_monitoring()) - return false; - - if (!monitoring_data_sink.get()) - return false; - - monitoring_data_sink_ = monitoring_data_sink; - - // Count myself in pending_capture_monitoring_snapshot_ack_count_, - // acked below. - pending_capture_monitoring_snapshot_ack_count_ = - trace_message_filters_.size() + 1; - pending_capture_monitoring_filters_ = trace_message_filters_; - - // Handle special case of zero child processes by immediately flushing the - // trace log. Once the flush has completed the caller will be notified that - // the capture snapshot has ended. - if (pending_capture_monitoring_snapshot_ack_count_ == 1) { - // Flush asynchronously now, because we don't have any children to wait for. - TraceLog::GetInstance()->FlushButLeaveBufferIntact( - base::Bind(&TracingControllerImpl::OnLocalMonitoringTraceDataCollected, - base::Unretained(this))); - } - - // Notify all child processes. - for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); - it != trace_message_filters_.end(); ++it) { - it->get()->SendCaptureMonitoringSnapshot(); - } - -#if defined(OS_ANDROID) - TraceLog::GetInstance()->AddClockSyncMetadataEvent(); -#endif - - return true; -} - bool TracingControllerImpl::GetTraceBufferUsage( const GetTraceBufferUsageCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -620,10 +490,6 @@ trace_message_filter->SendBeginTracing( TraceLog::GetInstance()->GetCurrentTraceConfig()); } - if (can_stop_monitoring()) { - trace_message_filter->SendStartMonitoring( - TraceLog::GetInstance()->GetCurrentTraceConfig()); - } FOR_EACH_OBSERVER(TraceMessageFilterObserver, trace_message_filter_observers_, OnTraceMessageFilterAdded(trace_message_filter)); @@ -658,16 +524,6 @@ std::vector<std::string>())); } } - if (pending_capture_monitoring_snapshot_ack_count_ > 0) { - TraceMessageFilterSet::const_iterator it = - pending_capture_monitoring_filters_.find(trace_message_filter); - if (it != pending_capture_monitoring_filters_.end()) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, - base::Unretained(this), - make_scoped_refptr(trace_message_filter))); - } - } if (pending_trace_log_status_ack_count_ > 0) { TraceMessageFilterSet::const_iterator it = pending_trace_log_status_filters_.find(trace_message_filter); @@ -823,44 +679,6 @@ OnStopTracingAcked(NULL, category_groups); } -void TracingControllerImpl::OnCaptureMonitoringSnapshotAcked( - TraceMessageFilter* trace_message_filter) { - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, - base::Unretained(this), - make_scoped_refptr(trace_message_filter))); - return; - } - - if (pending_capture_monitoring_snapshot_ack_count_ == 0) - return; - - if (trace_message_filter && - !pending_capture_monitoring_filters_.erase(trace_message_filter)) { - // The response from the specified message filter has already been received. - return; - } - - if (--pending_capture_monitoring_snapshot_ack_count_ == 1) { - // All acks from subprocesses have been received. Now flush the local trace. - // During or after this call, our OnLocalMonitoringTraceDataCollected - // will be called with the last of the local trace data. - TraceLog::GetInstance()->FlushButLeaveBufferIntact( - base::Bind(&TracingControllerImpl::OnLocalMonitoringTraceDataCollected, - base::Unretained(this))); - return; - } - - if (pending_capture_monitoring_snapshot_ack_count_ != 0) - return; - - if (monitoring_data_sink_.get()) { - monitoring_data_sink_->Close(); - monitoring_data_sink_ = NULL; - } -} - void TracingControllerImpl::OnTraceDataCollected( const scoped_refptr<base::RefCountedString>& events_str_ptr) { // OnTraceDataCollected may be called from any browser thread, either by the @@ -876,19 +694,6 @@ trace_data_sink_->AddTraceChunk(events_str_ptr->data()); } -void TracingControllerImpl::OnMonitoringTraceDataCollected( - const scoped_refptr<base::RefCountedString>& events_str_ptr) { - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&TracingControllerImpl::OnMonitoringTraceDataCollected, - base::Unretained(this), events_str_ptr)); - return; - } - - if (monitoring_data_sink_.get()) - monitoring_data_sink_->AddTraceChunk(events_str_ptr->data()); -} - void TracingControllerImpl::OnLocalTraceDataCollected( const scoped_refptr<base::RefCountedString>& events_str_ptr, bool has_more_events) { @@ -904,19 +709,6 @@ OnStopTracingAcked(NULL, category_groups); } -void TracingControllerImpl::OnLocalMonitoringTraceDataCollected( - const scoped_refptr<base::RefCountedString>& events_str_ptr, - bool has_more_events) { - if (events_str_ptr->data().size()) - OnMonitoringTraceDataCollected(events_str_ptr); - - if (has_more_events) - return; - - // Simulate an CaptureMonitoringSnapshotAcked for the local trace. - OnCaptureMonitoringSnapshotAcked(NULL); -} - void TracingControllerImpl::OnTraceLogStatusReply( TraceMessageFilter* trace_message_filter, const base::trace_event::TraceLogStatus& status) { @@ -1212,17 +1004,4 @@ pending_memory_dump_guid_ = 0; } -void TracingControllerImpl::OnMonitoringStateChanged(bool is_monitoring) { - if (is_monitoring_ == is_monitoring) - return; - - is_monitoring_ = is_monitoring; -#if !defined(OS_ANDROID) - for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); - it != tracing_uis_.end(); it++) { - (*it)->OnMonitoringStateChanged(is_monitoring); - } -#endif -} - } // namespace content
diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h index 3dc0b5aa..7a6c17b 100644 --- a/content/browser/tracing/tracing_controller_impl.h +++ b/content/browser/tracing/tracing_controller_impl.h
@@ -41,16 +41,6 @@ bool StartTracing(const base::trace_event::TraceConfig& trace_config, const StartTracingDoneCallback& callback) override; bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override; - bool StartMonitoring( - const base::trace_event::TraceConfig& trace_config, - const StartMonitoringDoneCallback& callback) override; - bool StopMonitoring( - const StopMonitoringDoneCallback& callback) override; - void GetMonitoringStatus( - bool* out_enabled, - base::trace_event::TraceConfig* out_trace_config) override; - bool CaptureMonitoringSnapshot( - const scoped_refptr<TraceDataSink>& sink) override; bool GetTraceBufferUsage( const GetTraceBufferUsageCallback& callback) override; bool SetWatchEvent(const std::string& category_name, @@ -124,17 +114,11 @@ void OnTraceDataCollected( const scoped_refptr<base::RefCountedString>& events_str_ptr); - void OnMonitoringTraceDataCollected( - const scoped_refptr<base::RefCountedString>& events_str_ptr); // Callback of TraceLog::Flush() for the local trace. void OnLocalTraceDataCollected( const scoped_refptr<base::RefCountedString>& events_str_ptr, bool has_more_events); - // Callback of TraceLog::FlushMonitoring() for the local trace. - void OnLocalMonitoringTraceDataCollected( - const scoped_refptr<base::RefCountedString>& events_str_ptr, - bool has_more_events); // Adds the tracing agent with the specified agent name to the list of // additional tracing agents. @@ -151,9 +135,6 @@ const std::string& events_label, const scoped_refptr<base::RefCountedString>& events_str_ptr); - void OnCaptureMonitoringSnapshotAcked( - TraceMessageFilter* trace_message_filter); - void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, const base::trace_event::TraceLogStatus& status); void OnProcessMemoryDumpResponse(TraceMessageFilter* trace_message_filter, @@ -175,12 +156,6 @@ void OnAllTracingAgentsStarted(); void StopTracingAfterClockSync(); void OnStopTracingDone(); - void OnStartMonitoringDone( - const base::trace_event::TraceConfig& trace_config, - const StartMonitoringDoneCallback& callback); - void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback); - - void OnMonitoringStateChanged(bool is_monitoring); // Issue clock sync markers to the tracing agents. void IssueClockSyncMarker(); @@ -202,10 +177,6 @@ int pending_stop_tracing_ack_count_; TraceMessageFilterSet pending_stop_tracing_filters_; - // Pending acks for CaptureMonitoringSnapshot. - int pending_capture_monitoring_snapshot_ack_count_; - TraceMessageFilterSet pending_capture_monitoring_filters_; - // Pending acks for GetTraceLogStatus. int pending_trace_log_status_ack_count_; TraceMessageFilterSet pending_trace_log_status_filters_;
diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index 13eaa40..074a771 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc
@@ -145,55 +145,6 @@ callback.Run(status_base64); } -void OnMonitoringEnabledAck(const WebUIDataSource::GotDataCallback& callback); - -bool StartMonitoring(const std::string& data64, - const WebUIDataSource::GotDataCallback& callback) { - base::trace_event::TraceConfig trace_config("", ""); - if (!GetTracingOptions(data64, &trace_config)) - return false; - - return TracingController::GetInstance()->StartMonitoring( - trace_config, - base::Bind(OnMonitoringEnabledAck, callback)); -} - -void OnMonitoringEnabledAck(const WebUIDataSource::GotDataCallback& callback) { - base::RefCountedString* res = new base::RefCountedString(); - callback.Run(res); -} - -void OnMonitoringDisabled(const WebUIDataSource::GotDataCallback& callback) { - base::RefCountedString* res = new base::RefCountedString(); - callback.Run(res); -} - -void GetMonitoringStatus(const WebUIDataSource::GotDataCallback& callback) { - bool is_monitoring; - base::trace_event::TraceConfig config("", ""); - TracingController::GetInstance()->GetMonitoringStatus( - &is_monitoring, &config); - - base::DictionaryValue monitoring_options; - monitoring_options.SetBoolean("isMonitoring", is_monitoring); - monitoring_options.SetString("categoryFilter", - config.ToCategoryFilterString()); - monitoring_options.SetBoolean("useSystemTracing", config.IsSystraceEnabled()); - monitoring_options.SetBoolean( - "useContinuousTracing", - config.GetTraceRecordMode() == base::trace_event::RECORD_CONTINUOUSLY); - monitoring_options.SetBoolean("useSampling", config.IsSamplingEnabled()); - - std::string monitoring_options_json; - base::JSONWriter::Write(monitoring_options, &monitoring_options_json); - - base::RefCountedString* monitoring_options_base64 = - new base::RefCountedString(); - base::Base64Encode(monitoring_options_json, - &monitoring_options_base64->data()); - callback.Run(monitoring_options_base64); -} - void TracingCallbackWrapperBase64( const WebUIDataSource::GotDataCallback& callback, scoped_ptr<const base::DictionaryValue> metadata, @@ -241,29 +192,6 @@ return TracingController::GetInstance()->StopTracing(data_sink); } - const char* StartMonitoringPath = "json/begin_monitoring?"; - if (path.find(StartMonitoringPath) == 0) { - std::string data = path.substr(strlen(StartMonitoringPath)); - return StartMonitoring(data, callback); - } - if (path == "json/end_monitoring") { - return TracingController::GetInstance()->StopMonitoring( - base::Bind(OnMonitoringDisabled, callback)); - } - if (path == "json/capture_monitoring_compressed") { - scoped_refptr<TracingControllerImpl::TraceDataSink> data_sink = - TracingController::CreateCompressedStringSink( - TracingController::CreateCallbackEndpoint( - base::Bind(TracingCallbackWrapperBase64, callback))); - AddCustomMetadata(data_sink.get()); - TracingController::GetInstance()->CaptureMonitoringSnapshot(data_sink); - return true; - } - if (path == "json/get_monitoring_status") { - GetMonitoringStatus(callback); - return true; - } - LOG(ERROR) << "Unhandled request to " << path; return false; } @@ -317,11 +245,6 @@ TracingControllerImpl::GetInstance()->UnregisterTracingUI(this); } -void TracingUI::OnMonitoringStateChanged(bool is_monitoring) { - web_ui()->CallJavascriptFunction( - "onMonitoringStateChanged", base::FundamentalValue(is_monitoring)); -} - void TracingUI::DoUploadBase64Encoded(const base::ListValue* args) { std::string file_contents_base64; if (!args || args->empty() || !args->GetString(0, &file_contents_base64)) {
diff --git a/content/browser/tracing/tracing_ui.h b/content/browser/tracing/tracing_ui.h index 22e8616..4e65de1 100644 --- a/content/browser/tracing/tracing_ui.h +++ b/content/browser/tracing/tracing_ui.h
@@ -24,7 +24,6 @@ public: explicit TracingUI(WebUI* web_ui); ~TracingUI() override; - void OnMonitoringStateChanged(bool is_monitoring); void OnTraceUploadProgress(int64_t current, int64_t total); void OnTraceUploadComplete(bool success, const std::string& feedback);
diff --git a/content/child/notifications/notification_data_conversions.cc b/content/child/notifications/notification_data_conversions.cc index 0c4d939..be7ad40c 100644 --- a/content/child/notifications/notification_data_conversions.cc +++ b/content/child/notifications/notification_data_conversions.cc
@@ -52,6 +52,8 @@ platform_data.actions[i].action = base::UTF16ToUTF8(base::StringPiece16(web_data.actions[i].action)); platform_data.actions[i].title = web_data.actions[i].title; + platform_data.actions[i].icon = + blink::WebStringToGURL(web_data.actions[i].icon.string()); } return platform_data; @@ -90,6 +92,7 @@ web_data.actions[i].action = blink::WebString::fromUTF8(platform_data.actions[i].action); web_data.actions[i].title = platform_data.actions[i].title; + web_data.actions[i].icon = blink::WebURL(platform_data.actions[i].icon); } return web_data;
diff --git a/content/child/notifications/notification_data_conversions_unittest.cc b/content/child/notifications/notification_data_conversions_unittest.cc index 8f58d30..090dd039 100644 --- a/content/child/notifications/notification_data_conversions_unittest.cc +++ b/content/child/notifications/notification_data_conversions_unittest.cc
@@ -28,8 +28,10 @@ const unsigned char kNotificationData[] = {0xdf, 0xff, 0x0, 0x0, 0xff, 0xdf}; const char kAction1Name[] = "btn1"; const char kAction1Title[] = "Button 1"; +const char kAction1IconUrl[] = "https://example.com/action_icon_1.png"; const char kAction2Name[] = "btn2"; const char kAction2Title[] = "Button 2"; +const char kAction2IconUrl[] = "https://example.com/action_icon_2.png"; TEST(NotificationDataConversionsTest, ToPlatformNotificationData) { blink::WebNotificationData web_data; @@ -51,8 +53,10 @@ blink::WebVector<blink::WebNotificationAction>(static_cast<size_t>(2)); web_data.actions[0].action = blink::WebString::fromUTF8(kAction1Name); web_data.actions[0].title = blink::WebString::fromUTF8(kAction1Title); + web_data.actions[0].icon = blink::WebURL(GURL(kAction1IconUrl)); web_data.actions[1].action = blink::WebString::fromUTF8(kAction2Name); web_data.actions[1].title = blink::WebString::fromUTF8(kAction2Title); + web_data.actions[1].icon = blink::WebURL(GURL(kAction2IconUrl)); PlatformNotificationData platform_data = ToPlatformNotificationData(web_data); EXPECT_EQ(base::ASCIIToUTF16(kNotificationTitle), platform_data.title); @@ -75,8 +79,10 @@ ASSERT_EQ(web_data.actions.size(), platform_data.actions.size()); EXPECT_EQ(kAction1Name, platform_data.actions[0].action); EXPECT_EQ(base::ASCIIToUTF16(kAction1Title), platform_data.actions[0].title); + EXPECT_EQ(kAction1IconUrl, platform_data.actions[0].icon.spec()); EXPECT_EQ(kAction2Name, platform_data.actions[1].action); EXPECT_EQ(base::ASCIIToUTF16(kAction2Title), platform_data.actions[1].title); + EXPECT_EQ(kAction2IconUrl, platform_data.actions[1].icon.spec()); } TEST(NotificationDataConversionsTest, ToWebNotificationData) { @@ -102,8 +108,10 @@ platform_data.actions.resize(2); platform_data.actions[0].action = kAction1Name; platform_data.actions[0].title = base::ASCIIToUTF16(kAction1Title); + platform_data.actions[0].icon = GURL(kAction1IconUrl); platform_data.actions[1].action = kAction2Name; platform_data.actions[1].title = base::ASCIIToUTF16(kAction2Title); + platform_data.actions[1].icon = GURL(kAction2IconUrl); blink::WebNotificationData web_data = ToWebNotificationData(platform_data); EXPECT_EQ(kNotificationTitle, web_data.title); @@ -129,8 +137,10 @@ ASSERT_EQ(platform_data.actions.size(), web_data.actions.size()); EXPECT_EQ(kAction1Name, web_data.actions[0].action); EXPECT_EQ(kAction1Title, web_data.actions[0].title); + EXPECT_EQ(kAction1IconUrl, web_data.actions[0].icon.string()); EXPECT_EQ(kAction2Name, web_data.actions[1].action); EXPECT_EQ(kAction2Title, web_data.actions[1].title); + EXPECT_EQ(kAction2IconUrl, web_data.actions[1].icon.string()); } TEST(NotificationDataConversionsTest, NotificationDataDirectionality) {
diff --git a/content/child/webblobregistry_impl.cc b/content/child/webblobregistry_impl.cc index 48a5739..3b534ea 100644 --- a/content/child/webblobregistry_impl.cc +++ b/content/child/webblobregistry_impl.cc
@@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/shared_memory.h" #include "base/message_loop/message_loop.h" +#include "base/numerics/safe_conversions.h" #include "base/trace_event/trace_event.h" #include "content/child/child_thread_impl.h" #include "content/child/thread_safe_sender.h" @@ -154,7 +155,8 @@ size_t chunk_size = std::min(remaining_bytes, shared_memory_size); memcpy(shared_memory->memory(), current_ptr, chunk_size); sender_->Send(new StreamHostMsg_SyncAppendSharedMemory( - url, shared_memory->handle(), chunk_size)); + url, shared_memory->handle(), + base::checked_cast<uint32_t>(chunk_size))); remaining_bytes -= chunk_size; current_ptr += chunk_size; }
diff --git a/content/common/platform_notification_messages.h b/content/common/platform_notification_messages.h index 02e31ec..9fda6d9 100644 --- a/content/common/platform_notification_messages.h +++ b/content/common/platform_notification_messages.h
@@ -39,6 +39,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationAction) IPC_STRUCT_TRAITS_MEMBER(action) IPC_STRUCT_TRAITS_MEMBER(title) + IPC_STRUCT_TRAITS_MEMBER(icon) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::PlatformNotificationData)
diff --git a/content/public/browser/mojo_app_connection.h b/content/public/browser/mojo_app_connection.h index 925f751d..4cfa274 100644 --- a/content/public/browser/mojo_app_connection.h +++ b/content/public/browser/mojo_app_connection.h
@@ -37,12 +37,12 @@ // Connects to a service within the application. template <typename Interface> - void ConnectToService(mojo::InterfacePtr<Interface>* proxy) { - ConnectToService(Interface::Name_, mojo::GetProxy(proxy).PassMessagePipe()); + void GetInterface(mojo::InterfacePtr<Interface>* proxy) { + GetInterface(Interface::Name_, mojo::GetProxy(proxy).PassMessagePipe()); } - virtual void ConnectToService(const std::string& service_name, - mojo::ScopedMessagePipeHandle handle) = 0; + virtual void GetInterface(const std::string& interface_name, + mojo::ScopedMessagePipeHandle handle) = 0; }; } // namespace content
diff --git a/content/public/browser/tracing_controller.h b/content/public/browser/tracing_controller.h index c910377..64bf8cee 100644 --- a/content/public/browser/tracing_controller.h +++ b/content/public/browser/tracing_controller.h
@@ -30,9 +30,9 @@ CONTENT_EXPORT static TracingController* GetInstance(); - // An interface for trace data consumer. An implemnentation of this interface - // is passed to either DisableTracing() or CaptureMonitoringSnapshot() and - // receives the trace data followed by a notification that all child processes + // An interface for trace data consumer. An implementation of this interface + // is passed to DisableTracing() and receives the trace data + // followed by a notification that all child processes // have completed tracing and the data collection is over. // All methods are called on the UI thread. // Close method will be called exactly once and no methods will be @@ -90,8 +90,8 @@ virtual ~TraceDataEndpoint() {} }; - // Create a trace sink that may be supplied to StopTracing or - // CaptureMonitoringSnapshot to capture the trace data as a string. + // Create a trace sink that may be supplied to StopTracing + // to capture the trace data as a string. CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateStringSink( const base::Callback<void(scoped_ptr<const base::DictionaryValue>, base::RefCountedString*)>& callback); @@ -99,8 +99,8 @@ CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateCompressedStringSink( scoped_refptr<TraceDataEndpoint> endpoint); - // Create a trace sink that may be supplied to StopTracing or - // CaptureMonitoringSnapshot to dump the trace data to a file. + // Create a trace sink that may be supplied to StopTracing + // to dump the trace data to a file. CONTENT_EXPORT static scoped_refptr<TraceDataSink> CreateFileSink( const base::FilePath& file_path, const base::Closure& callback); @@ -170,54 +170,6 @@ virtual bool StopTracing( const scoped_refptr<TraceDataSink>& trace_data_sink) = 0; - // Start monitoring on all processes. - // - // Monitoring begins immediately locally, and asynchronously on child - // processes as soon as they receive the StartMonitoring request. - // - // Once all child processes have acked to the StartMonitoring request, - // StartMonitoringDoneCallback will be called back. - // - // |category_filter| is a filter to control what category groups should be - // traced. - // - // |trace_config| controls what kind of tracing is enabled. - typedef base::Callback<void()> StartMonitoringDoneCallback; - virtual bool StartMonitoring( - const base::trace_event::TraceConfig& trace_config, - const StartMonitoringDoneCallback& callback) = 0; - - // Stop monitoring on all processes. - // - // Once all child processes have acked to the StopMonitoring request, - // StopMonitoringDoneCallback is called back. - typedef base::Callback<void()> StopMonitoringDoneCallback; - virtual bool StopMonitoring( - const StopMonitoringDoneCallback& callback) = 0; - - // Get the current monitoring configuration. - virtual void GetMonitoringStatus( - bool* out_enabled, - base::trace_event::TraceConfig* out_trace_config) = 0; - - // Get the current monitoring traced data. - // - // Child processes typically are caching trace data and only rarely flush - // and send trace data back to the browser process. That is because it may be - // an expensive operation to send the trace data over IPC, and we would like - // to avoid much runtime overhead of tracing. So, to end tracing, we must - // asynchronously ask all child processes to flush any pending trace data. - // - // Once all child processes have acked to the CaptureMonitoringSnapshot - // request, TracingFileResultCallback will be called back with a file that - // contains the traced data. - // - // If |trace_data_sink| is not null, it will receive chunks of trace data - // as a comma-separated sequences of JSON-stringified events, followed by - // a notification that the trace collection is finished. - virtual bool CaptureMonitoringSnapshot( - const scoped_refptr<TraceDataSink>& trace_data_sink) = 0; - // Get the maximum across processes of trace buffer percent full state. // When the TraceBufferUsage value is determined, the callback is // called.
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index 45a9516..9f5b1a2 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h
@@ -200,6 +200,7 @@ IPC_STRUCT_TRAITS_MEMBER(v8_cache_options) IPC_STRUCT_TRAITS_MEMBER(pepper_accelerated_video_decode_enabled) IPC_STRUCT_TRAITS_MEMBER(animation_policy) + IPC_STRUCT_TRAITS_MEMBER(user_gesture_required_for_presentation) #if defined(OS_ANDROID) IPC_STRUCT_TRAITS_MEMBER(text_autosizing_enabled) IPC_STRUCT_TRAITS_MEMBER(font_scale_factor)
diff --git a/content/public/common/content_descriptors.h b/content/public/common/content_descriptors.h index a3077cd..692b8bd 100644 --- a/content/public/common/content_descriptors.h +++ b/content/public/common/content_descriptors.h
@@ -15,9 +15,16 @@ kSandboxIPCChannel, // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ipc.md #if defined(V8_USE_EXTERNAL_STARTUP_DATA) +#if defined(OS_ANDROID) + kV8NativesDataDescriptor32, + kV8SnapshotDataDescriptor32, + kV8NativesDataDescriptor64, + kV8SnapshotDataDescriptor64, +#else kV8NativesDataDescriptor, kV8SnapshotDataDescriptor, #endif +#endif #if defined(OS_ANDROID) kAndroidPropertyDescriptor,
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 9034173..21330fe 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc
@@ -133,6 +133,10 @@ const char kDisableGestureRequirementForMediaPlayback[] = "disable-gesture-requirement-for-media-playback"; +// Disable user gesture requirement for presentation. +const char kDisableGestureRequirementForPresentation[] = + "disable-gesture-requirement-for-presentation"; + // Disables GPU hardware acceleration. If software renderer is not in place, // then the GPU process won't launch. const char kDisableGpu[] = "disable-gpu";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index cd8888e..93dba621 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h
@@ -50,6 +50,7 @@ CONTENT_EXPORT extern const char kDisableFlash3d[]; CONTENT_EXPORT extern const char kDisableFlashStage3d[]; CONTENT_EXPORT extern const char kDisableGestureRequirementForMediaPlayback[]; +CONTENT_EXPORT extern const char kDisableGestureRequirementForPresentation[]; CONTENT_EXPORT extern const char kDisableGpu[]; CONTENT_EXPORT extern const char kDisableGpuCompositing[]; CONTENT_EXPORT extern const char kDisableGpuEarlyInit[];
diff --git a/content/public/common/platform_notification_data.h b/content/public/common/platform_notification_data.h index 65a8891..45781be 100644 --- a/content/public/common/platform_notification_data.h +++ b/content/public/common/platform_notification_data.h
@@ -27,6 +27,9 @@ // Title of the button. base::string16 title; + + // URL of the icon for the button. May be empty if no url was specified. + GURL icon; }; // Structure representing the information associated with a Web Notification.
diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc index 61e213d69..a9dcef33 100644 --- a/content/public/common/web_preferences.cc +++ b/content/public/common/web_preferences.cc
@@ -162,6 +162,7 @@ cookie_enabled(true), pepper_accelerated_video_decode_enabled(false), animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED), + user_gesture_required_for_presentation(true), #if defined(OS_ANDROID) text_autosizing_enabled(true), font_scale_factor(1.0f),
diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h index 7d6ca7d..ba1a2314 100644 --- a/content/public/common/web_preferences.h +++ b/content/public/common/web_preferences.h
@@ -189,6 +189,8 @@ ImageAnimationPolicy animation_policy; + bool user_gesture_required_for_presentation; + #if defined(OS_ANDROID) bool text_autosizing_enabled; float font_scale_factor;
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java index 7a5d4bba1..b4528ed 100644 --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java
@@ -6,7 +6,6 @@ import android.test.InstrumentationTestCase; -import org.chromium.base.PathUtils; import org.chromium.base.ThreadUtils; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; @@ -18,8 +17,6 @@ * Test extension that adds support for loading and dealing with native libraries. */ public class NativeLibraryTestBase extends InstrumentationTestCase { - private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content"; - /** * Loads the native library on the activity UI thread (must not be called from the UI thread). */ @@ -38,9 +35,6 @@ private void handleNativeInitialization(final boolean initBrowserProcess) { assertFalse(ThreadUtils.runningOnUiThread()); - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, - getInstrumentation().getTargetContext()); - try { ApplicationUtils.waitForLibraryDependencies(getInstrumentation()); } catch (InterruptedException e) {
diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc index 2df36049..7ae75a0c 100644 --- a/content/renderer/media/media_stream_audio_processor.cc +++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -23,7 +23,7 @@ #include "media/base/audio_fifo.h" #include "media/base/channel_layout.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" +#include "third_party/webrtc/api/mediaconstraintsinterface.h" #include "third_party/webrtc/modules/audio_processing/typing_detection.h" namespace content {
diff --git a/content/renderer/media/media_stream_audio_processor.h b/content/renderer/media/media_stream_audio_processor.h index dabc42f..478b594 100644 --- a/content/renderer/media/media_stream_audio_processor.h +++ b/content/renderer/media/media_stream_audio_processor.h
@@ -18,7 +18,7 @@ #include "content/renderer/media/audio_repetition_detector.h" #include "content/renderer/media/webrtc_audio_device_impl.h" #include "media/base/audio_converter.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" namespace blink {
diff --git a/content/renderer/media/media_stream_audio_processor_options.h b/content/renderer/media/media_stream_audio_processor_options.h index 6a2048a..ea583e1 100644 --- a/content/renderer/media/media_stream_audio_processor_options.h +++ b/content/renderer/media/media_stream_audio_processor_options.h
@@ -12,7 +12,7 @@ #include "content/common/content_export.h" #include "content/public/common/media_stream_request.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc {
diff --git a/content/renderer/media/media_stream_audio_processor_unittest.cc b/content/renderer/media/media_stream_audio_processor_unittest.cc index a23d03e..62e4db8 100644 --- a/content/renderer/media/media_stream_audio_processor_unittest.cc +++ b/content/renderer/media/media_stream_audio_processor_unittest.cc
@@ -24,7 +24,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" using ::testing::_; using ::testing::AnyNumber;
diff --git a/content/renderer/media/media_stream_audio_source.h b/content/renderer/media/media_stream_audio_source.h index e332b83e..b2f44d2 100644 --- a/content/renderer/media/media_stream_audio_source.h +++ b/content/renderer/media/media_stream_audio_source.h
@@ -11,7 +11,7 @@ #include "content/renderer/media/media_stream_source.h" #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" #include "content/renderer/media/webrtc_audio_capturer.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/media_stream_audio_track.cc b/content/renderer/media/media_stream_audio_track.cc index 89bc39f..278ab05 100644 --- a/content/renderer/media/media_stream_audio_track.cc +++ b/content/renderer/media/media_stream_audio_track.cc
@@ -6,7 +6,7 @@ #include "base/logging.h" #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/media_stream_renderer_factory_impl.cc b/content/renderer/media/media_stream_renderer_factory_impl.cc index 40463f5..3fa439c4 100644 --- a/content/renderer/media/media_stream_renderer_factory_impl.cc +++ b/content/renderer/media/media_stream_renderer_factory_impl.cc
@@ -17,7 +17,7 @@ #include "third_party/WebKit/public/platform/WebMediaStream.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/mock_constraint_factory.cc b/content/renderer/media/mock_constraint_factory.cc index 4e2b414..63ae5f0 100644 --- a/content/renderer/media/mock_constraint_factory.cc +++ b/content/renderer/media/mock_constraint_factory.cc
@@ -9,7 +9,7 @@ #include "base/strings/utf_string_conversions.h" #include "content/renderer/media/media_stream_audio_processor_options.h" #include "content/renderer/media/mock_constraint_factory.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" +#include "third_party/webrtc/api/mediaconstraintsinterface.h" namespace content {
diff --git a/content/renderer/media/mock_data_channel_impl.h b/content/renderer/media/mock_data_channel_impl.h index 9b82669..0b763dc 100644 --- a/content/renderer/media/mock_data_channel_impl.h +++ b/content/renderer/media/mock_data_channel_impl.h
@@ -10,7 +10,7 @@ #include <string> #include "base/macros.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" namespace content {
diff --git a/content/renderer/media/mock_media_constraint_factory.cc b/content/renderer/media/mock_media_constraint_factory.cc index 66bb1c6..2537d0f 100644 --- a/content/renderer/media/mock_media_constraint_factory.cc +++ b/content/renderer/media/mock_media_constraint_factory.cc
@@ -9,7 +9,7 @@ #include "base/strings/utf_string_conversions.h" #include "content/renderer/media/media_stream_audio_processor_options.h" #include "content/renderer/media/mock_media_constraint_factory.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" +#include "third_party/webrtc/api/mediaconstraintsinterface.h" namespace content {
diff --git a/content/renderer/media/mock_peer_connection_impl.h b/content/renderer/media/mock_peer_connection_impl.h index dae0b9c..a0b51398 100644 --- a/content/renderer/media/mock_peer_connection_impl.h +++ b/content/renderer/media/mock_peer_connection_impl.h
@@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "testing/gmock/include/gmock/gmock.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" namespace content {
diff --git a/content/renderer/media/peer_connection_identity_store.h b/content/renderer/media/peer_connection_identity_store.h index 82afbdc3..35d99c5 100644 --- a/content/renderer/media/peer_connection_identity_store.h +++ b/content/renderer/media/peer_connection_identity_store.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" -#include "third_party/libjingle/source/talk/app/webrtc/dtlsidentitystore.h" +#include "third_party/webrtc/api/dtlsidentitystore.h" #include "url/gurl.h" namespace content {
diff --git a/content/renderer/media/peer_connection_tracker.h b/content/renderer/media/peer_connection_tracker.h index 2181ca8..bb01fb93 100644 --- a/content/renderer/media/peer_connection_tracker.h +++ b/content/renderer/media/peer_connection_tracker.h
@@ -15,7 +15,7 @@ #include "third_party/WebKit/public/platform/WebMediaStream.h" #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h" #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" namespace blink { class WebFrame;
diff --git a/content/renderer/media/remote_media_stream_impl.h b/content/renderer/media/remote_media_stream_impl.h index 91b92940..75bfbc84 100644 --- a/content/renderer/media/remote_media_stream_impl.h +++ b/content/renderer/media/remote_media_stream_impl.h
@@ -14,7 +14,7 @@ #include "base/threading/thread_checker.h" #include "content/common/content_export.h" #include "third_party/WebKit/public/platform/WebMediaStream.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/rtc_data_channel_handler.h b/content/renderer/media/rtc_data_channel_handler.h index 1206d75..ff08ee2 100644 --- a/content/renderer/media/rtc_data_channel_handler.h +++ b/content/renderer/media/rtc_data_channel_handler.h
@@ -15,7 +15,7 @@ #include "content/common/content_export.h" #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" namespace content {
diff --git a/content/renderer/media/rtc_dtmf_sender_handler.h b/content/renderer/media/rtc_dtmf_sender_handler.h index 6967d48..b18abce6 100644 --- a/content/renderer/media/rtc_dtmf_sender_handler.h +++ b/content/renderer/media/rtc_dtmf_sender_handler.h
@@ -14,7 +14,7 @@ #include "content/common/content_export.h" #include "third_party/WebKit/public/platform/WebRTCDTMFSenderHandler.h" #include "third_party/WebKit/public/platform/WebRTCDTMFSenderHandlerClient.h" -#include "third_party/libjingle/source/talk/app/webrtc/dtmfsenderinterface.h" +#include "third_party/webrtc/api/dtmfsenderinterface.h" namespace content {
diff --git a/content/renderer/media/rtc_media_constraints.h b/content/renderer/media/rtc_media_constraints.h index 2c6ab27c..8aff1456 100644 --- a/content/renderer/media/rtc_media_constraints.h +++ b/content/renderer/media/rtc_media_constraints.h
@@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "content/common/content_export.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" +#include "third_party/webrtc/api/mediaconstraintsinterface.h" namespace blink { class WebMediaConstraints;
diff --git a/content/renderer/media/rtc_peer_connection_handler_unittest.cc b/content/renderer/media/rtc_peer_connection_handler_unittest.cc index 51d195cd..697f484 100644 --- a/content/renderer/media/rtc_peer_connection_handler_unittest.cc +++ b/content/renderer/media/rtc_peer_connection_handler_unittest.cc
@@ -48,7 +48,7 @@ #include "third_party/WebKit/public/platform/WebRTCVoidRequest.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebHeap.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" static const char kDummySdp[] = "dummy sdp"; static const char kDummySdpType[] = "dummy type";
diff --git a/content/renderer/media/user_media_client_impl.h b/content/renderer/media/user_media_client_impl.h index 04cc2e0..7beb153 100644 --- a/content/renderer/media/user_media_client_impl.h +++ b/content/renderer/media/user_media_client_impl.h
@@ -26,7 +26,7 @@ #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h" #include "third_party/WebKit/public/web/WebUserMediaClient.h" #include "third_party/WebKit/public/web/WebUserMediaRequest.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content { class PeerConnectionDependencyFactory;
diff --git a/content/renderer/media/webrtc/media_stream_remote_audio_track.cc b/content/renderer/media/webrtc/media_stream_remote_audio_track.cc index 8bb5e0a5..17df845f 100644 --- a/content/renderer/media/webrtc/media_stream_remote_audio_track.cc +++ b/content/renderer/media/webrtc/media_stream_remote_audio_track.cc
@@ -10,7 +10,7 @@ #include "base/logging.h" #include "content/public/renderer/media_stream_audio_sink.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source.h b/content/renderer/media/webrtc/media_stream_remote_video_source.h index 1f24c75b..344748f 100644 --- a/content/renderer/media/webrtc/media_stream_remote_video_source.h +++ b/content/renderer/media/webrtc/media_stream_remote_video_source.h
@@ -11,7 +11,7 @@ #include "content/common/content_export.h" #include "content/renderer/media/media_stream_video_source.h" #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/webrtc/media_stream_track_metrics.cc b/content/renderer/media/webrtc/media_stream_track_metrics.cc index 3353692..21f2da6 100644 --- a/content/renderer/media/webrtc/media_stream_track_metrics.cc +++ b/content/renderer/media/webrtc/media_stream_track_metrics.cc
@@ -12,7 +12,7 @@ #include "base/thread_task_runner_handle.h" #include "content/common/media/media_stream_track_metrics_host_messages.h" #include "content/renderer/render_thread_impl.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" using webrtc::AudioTrackVector; using webrtc::MediaStreamInterface;
diff --git a/content/renderer/media/webrtc/media_stream_track_metrics.h b/content/renderer/media/webrtc/media_stream_track_metrics.h index 4f2cd0e..2f3feca 100644 --- a/content/renderer/media/webrtc/media_stream_track_metrics.h +++ b/content/renderer/media/webrtc/media_stream_track_metrics.h
@@ -10,7 +10,7 @@ #include "base/memory/scoped_vector.h" #include "base/threading/non_thread_safe.h" #include "content/common/content_export.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" namespace webrtc { class MediaStreamInterface;
diff --git a/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc b/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc index 8f10d55..efb9f73 100644 --- a/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc +++ b/content/renderer/media/webrtc/media_stream_track_metrics_unittest.cc
@@ -12,7 +12,7 @@ #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" using webrtc::AudioSourceInterface; using webrtc::AudioTrackInterface;
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h index 57c37021..346d434 100644 --- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h +++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h
@@ -10,8 +10,8 @@ #include "content/public/renderer/media_stream_video_sink.h" #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" +#include "third_party/webrtc/api/videosourceinterface.h" namespace content {
diff --git a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc index 4d8fe77..c414454 100644 --- a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc
@@ -15,7 +15,7 @@ #include "content/renderer/media/webrtc_audio_capturer.h" #include "content/renderer/media/webrtc_local_audio_track.h" #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" #include "third_party/webrtc/base/scoped_ref_ptr.h" #include "third_party/webrtc/media/base/videocapturer.h"
diff --git a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h index 943b20f..60dec668 100644 --- a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h +++ b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h
@@ -12,7 +12,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" +#include "third_party/webrtc/api/mediaconstraintsinterface.h" #include "third_party/webrtc/media/base/videorenderer.h" #include "third_party/webrtc/media/base/videosinkinterface.h"
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc index a2e3f18..966a295 100644 --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -65,7 +65,7 @@ #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h" +#include "third_party/webrtc/api/mediaconstraintsinterface.h" #include "third_party/webrtc/base/ssladapter.h" #include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h"
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.h b/content/renderer/media/webrtc/peer_connection_dependency_factory.h index a5bdb34..212eefb 100644 --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.h +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.h
@@ -16,8 +16,8 @@ #include "content/renderer/media/webrtc/stun_field_trial.h" #include "content/renderer/p2p/socket_dispatcher.h" #include "ipc/ipc_platform_file.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" +#include "third_party/webrtc/api/videosourceinterface.h" #include "third_party/webrtc/p2p/stunprober/stunprober.h" namespace base {
diff --git a/content/renderer/media/webrtc/track_observer.h b/content/renderer/media/webrtc/track_observer.h index c0a6ad42..2a542b8d 100644 --- a/content/renderer/media/webrtc/track_observer.h +++ b/content/renderer/media/webrtc/track_observer.h
@@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "content/common/content_export.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/webrtc/webrtc_audio_sink_adapter.cc b/content/renderer/media/webrtc/webrtc_audio_sink_adapter.cc index 715309e7..2679aff 100644 --- a/content/renderer/media/webrtc/webrtc_audio_sink_adapter.cc +++ b/content/renderer/media/webrtc/webrtc_audio_sink_adapter.cc
@@ -5,7 +5,7 @@ #include "base/logging.h" #include "content/renderer/media/webrtc/webrtc_audio_sink_adapter.h" #include "media/base/audio_bus.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.cc b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.cc index 3c86a1f..20a3969 100644 --- a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.cc +++ b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.cc
@@ -11,7 +11,7 @@ #include "content/renderer/media/webrtc/webrtc_audio_sink_adapter.h" #include "content/renderer/media/webrtc_local_audio_track.h" #include "content/renderer/render_thread_impl.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h index c52066eb..cfe4a98 100644 --- a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h +++ b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h
@@ -13,7 +13,7 @@ #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" #include "content/common/content_export.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h" +#include "third_party/webrtc/api/mediastreamtrack.h" #include "third_party/webrtc/media/base/audiorenderer.h" namespace cricket {
diff --git a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc index e34ddb73..0230e064 100644 --- a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc +++ b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
@@ -10,7 +10,7 @@ #include "content/renderer/media/webrtc_local_audio_track.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" using ::testing::_; using ::testing::AnyNumber;
diff --git a/content/renderer/media/webrtc/webrtc_media_stream_adapter.h b/content/renderer/media/webrtc/webrtc_media_stream_adapter.h index 3b8a3e7..eba23db 100644 --- a/content/renderer/media/webrtc/webrtc_media_stream_adapter.h +++ b/content/renderer/media/webrtc/webrtc_media_stream_adapter.h
@@ -11,7 +11,7 @@ #include "content/common/content_export.h" #include "content/renderer/media/media_stream.h" #include "third_party/WebKit/public/platform/WebMediaStream.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace content {
diff --git a/content/renderer/media/webrtc_audio_renderer.cc b/content/renderer/media/webrtc_audio_renderer.cc index 5b17248..49fc1857 100644 --- a/content/renderer/media/webrtc_audio_renderer.cc +++ b/content/renderer/media/webrtc_audio_renderer.cc
@@ -22,7 +22,7 @@ #include "media/audio/audio_parameters.h" #include "media/audio/sample_rates.h" #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" #include "third_party/webrtc/media/base/audiorenderer.h" #if defined(OS_WIN)
diff --git a/content/renderer/media/webrtc_audio_renderer_unittest.cc b/content/renderer/media/webrtc_audio_renderer_unittest.cc index 86710d55..7797ffa1 100644 --- a/content/renderer/media/webrtc_audio_renderer_unittest.cc +++ b/content/renderer/media/webrtc_audio_renderer_unittest.cc
@@ -25,7 +25,7 @@ #include "third_party/WebKit/public/platform/WebMediaStream.h" #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" #include "third_party/WebKit/public/web/WebHeap.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" using testing::Return; using testing::_;
diff --git a/content/renderer/media/webrtc_local_audio_track_unittest.cc b/content/renderer/media/webrtc_local_audio_track_unittest.cc index 60123b0..986a536 100644 --- a/content/renderer/media/webrtc_local_audio_track_unittest.cc +++ b/content/renderer/media/webrtc_local_audio_track_unittest.cc
@@ -19,7 +19,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" #include "third_party/WebKit/public/web/WebHeap.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" using ::testing::_; using ::testing::AnyNumber;
diff --git a/content/renderer/mus/render_widget_mus_connection.cc b/content/renderer/mus/render_widget_mus_connection.cc index 2a90bbe6..c7dbac8 100644 --- a/content/renderer/mus/render_widget_mus_connection.cc +++ b/content/renderer/mus/render_widget_mus_connection.cc
@@ -49,8 +49,8 @@ DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!window_surface_binding_); mus::mojom::GpuPtr gpu_service; - MojoShellConnection::Get()->GetShell()->ConnectToService("mojo:mus", - &gpu_service); + MojoShellConnection::Get()->GetShell()->ConnectToInterface("mojo:mus", + &gpu_service); mus::mojom::CommandBufferPtr cb; gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); scoped_refptr<cc::ContextProvider> context_provider(
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 24747fa..94e06fc 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -5996,7 +5996,7 @@ media::MediaPermission* RenderFrameImpl::GetMediaPermission() { if (!media_permission_dispatcher_) { media_permission_dispatcher_.reset(new MediaPermissionDispatcher( - base::Bind(&RenderFrameImpl::ConnectToService<PermissionService>, + base::Bind(&RenderFrameImpl::GetInterface<PermissionService>, base::Unretained(this)))); } return media_permission_dispatcher_.get(); @@ -6007,7 +6007,7 @@ if (!media_service_factory_) { mojo::InterfaceProviderPtr service_provider = ConnectToApplication(GURL("mojo:media")); - mojo::ConnectToService(service_provider.get(), &media_service_factory_); + mojo::GetInterface(service_provider.get(), &media_service_factory_); media_service_factory_.set_connection_error_handler( base::Bind(&RenderFrameImpl::OnMediaServiceFactoryConnectionError, base::Unretained(this))); @@ -6070,8 +6070,7 @@ } template <typename Interface> -void RenderFrameImpl::ConnectToService( - mojo::InterfaceRequest<Interface> request) { +void RenderFrameImpl::GetInterface(mojo::InterfaceRequest<Interface> request) { GetServiceRegistry()->ConnectToRemoteService(std::move(request)); }
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index c161925..7366de2 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -961,7 +961,7 @@ // Connect to an interface provided by the service registry. template <typename Interface> - void ConnectToService(mojo::InterfaceRequest<Interface> request); + void GetInterface(mojo::InterfaceRequest<Interface> request); // Connects to a Mojo application and returns a proxy to its exposed // ServiceProvider.
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 61639235..5a3f5482 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -1063,6 +1063,9 @@ settings->setImageAnimationPolicy( static_cast<WebSettings::ImageAnimationPolicy>(prefs.animation_policy)); + settings->setPresentationRequiresUserGesture( + prefs.user_gesture_required_for_presentation); + // Needs to happen before setIgnoreVIewportTagScaleLimits below. web_view->setDefaultPageScaleLimits( prefs.default_minimum_page_scale_factor,
diff --git a/device/battery/BUILD.gn b/device/battery/BUILD.gn index 158dce3..5bf49ce 100644 --- a/device/battery/BUILD.gn +++ b/device/battery/BUILD.gn
@@ -48,7 +48,7 @@ ] } - if (is_desktop_linux) { + if (is_linux && !is_chromeos) { if (use_dbus) { configs += [ "//build/config/linux:dbus" ] deps += [ "//dbus" ]
diff --git a/device/devices_app/devices_apptest.cc b/device/devices_app/devices_apptest.cc index 6929e85..1ac56ae 100644 --- a/device/devices_app/devices_apptest.cc +++ b/device/devices_app/devices_apptest.cc
@@ -22,7 +22,7 @@ void SetUp() override { ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:devices", &usb_device_manager_); + shell()->ConnectToInterface("mojo:devices", &usb_device_manager_); } usb::DeviceManager* usb_device_manager() { return usb_device_manager_.get(); }
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index cfb3630e..bb31951 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc
@@ -11,6 +11,7 @@ #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/memory_mapped_file.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" @@ -50,19 +51,34 @@ // File handles intentionally never closed. Not using File here because its // Windows implementation guards against two instances owning the same // PlatformFile (which we allow since we know it is never freed). -base::PlatformFile g_natives_pf = kInvalidPlatformFile; -base::PlatformFile g_snapshot_pf = kInvalidPlatformFile; -base::MemoryMappedFile::Region g_natives_region; -base::MemoryMappedFile::Region g_snapshot_region; +typedef std::map<const char*, + std::pair<base::PlatformFile, base::MemoryMappedFile::Region>> + OpenedFileMap; +static base::LazyInstance<OpenedFileMap>::Leaky g_opened_files = + LAZY_INSTANCE_INITIALIZER; + +OpenedFileMap::mapped_type& GetOpenedFile(const char* file) { + OpenedFileMap& opened_files(g_opened_files.Get()); + if (opened_files.find(file) == opened_files.end()) { + opened_files[file] = + std::make_pair(kInvalidPlatformFile, base::MemoryMappedFile::Region()); + } + return opened_files[file]; +} #if defined(OS_ANDROID) -#ifdef __LP64__ -const char kNativesFileName[] = "natives_blob_64.bin"; -const char kSnapshotFileName[] = "snapshot_blob_64.bin"; +const char kNativesFileName64[] = "natives_blob_64.bin"; +const char kSnapshotFileName64[] = "snapshot_blob_64.bin"; +const char kNativesFileName32[] = "natives_blob_32.bin"; +const char kSnapshotFileName32[] = "snapshot_blob_32.bin"; + +#if defined(__LP64__) +#define kNativesFileName kNativesFileName64 +#define kSnapshotFileName kSnapshotFileName64 #else -const char kNativesFileName[] = "natives_blob_32.bin"; -const char kSnapshotFileName[] = "snapshot_blob_32.bin"; -#endif // __LP64__ +#define kNativesFileName kNativesFileName32 +#define kSnapshotFileName kSnapshotFileName32 +#endif #else // defined(OS_ANDROID) const char kNativesFileName[] = "natives_blob.bin"; @@ -170,16 +186,13 @@ return file.TakePlatformFile(); } -void OpenNativesFileIfNecessary() { - if (g_natives_pf == kInvalidPlatformFile) { - g_natives_pf = OpenV8File(kNativesFileName, &g_natives_region); +static const OpenedFileMap::mapped_type OpenFileIfNecessary( + const char* file_name) { + OpenedFileMap::mapped_type& opened = GetOpenedFile(file_name); + if (opened.first == kInvalidPlatformFile) { + opened.first = OpenV8File(file_name, &opened.second); } -} - -void OpenSnapshotFileIfNecessary() { - if (g_snapshot_pf == kInvalidPlatformFile) { - g_snapshot_pf = OpenV8File(kSnapshotFileName, &g_snapshot_region); - } + return opened; } #if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA) @@ -236,15 +249,14 @@ V8_LOAD_MAX_VALUE }; -static LoadV8FileResult MapVerify(base::PlatformFile platform_file, - const base::MemoryMappedFile::Region& region, +static LoadV8FileResult MapVerify(const OpenedFileMap::mapped_type& file_region, #if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA) const unsigned char* fingerprint, #endif base::MemoryMappedFile** mmapped_file_out) { - if (platform_file == kInvalidPlatformFile) + if (file_region.first == kInvalidPlatformFile) return V8_LOAD_FAILED_OPEN; - if (!MapV8File(platform_file, region, mmapped_file_out)) + if (!MapV8File(file_region.first, file_region.second, mmapped_file_out)) return V8_LOAD_FAILED_MAP; #if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA) if (!VerifyV8StartupFile(mmapped_file_out, fingerprint)) @@ -258,8 +270,8 @@ if (g_mapped_snapshot) return; - OpenSnapshotFileIfNecessary(); - LoadV8FileResult result = MapVerify(g_snapshot_pf, g_snapshot_region, + OpenFileIfNecessary(kSnapshotFileName); + LoadV8FileResult result = MapVerify(GetOpenedFile(kSnapshotFileName), #if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA) g_snapshot_fingerprint, #endif @@ -274,8 +286,8 @@ if (g_mapped_natives) return; - OpenNativesFileIfNecessary(); - LoadV8FileResult result = MapVerify(g_natives_pf, g_natives_region, + OpenFileIfNecessary(kNativesFileName); + LoadV8FileResult result = MapVerify(GetOpenedFile(kNativesFileName), #if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA) g_natives_fingerprint, #endif @@ -311,8 +323,8 @@ result = V8_LOAD_FAILED_VERIFY; #endif // V8_VERIFY_EXTERNAL_STARTUP_DATA if (result == V8_LOAD_SUCCESS) { - g_snapshot_pf = snapshot_pf; - g_snapshot_region = snapshot_region; + g_opened_files.Get()[kSnapshotFileName] = + std::make_pair(snapshot_pf, snapshot_region); } UMA_HISTOGRAM_ENUMERATION("V8.Initializer.LoadV8Snapshot.Result", result, V8_LOAD_MAX_VALUE); @@ -342,25 +354,51 @@ LOG(FATAL) << "Couldn't verify contents of v8 natives data file"; } #endif // V8_VERIFY_EXTERNAL_STARTUP_DATA - g_natives_pf = natives_pf; - g_natives_region = natives_region; + g_opened_files.Get()[kNativesFileName] = + std::make_pair(natives_pf, natives_region); } // static base::PlatformFile V8Initializer::GetOpenNativesFileForChildProcesses( base::MemoryMappedFile::Region* region_out) { - OpenNativesFileIfNecessary(); - *region_out = g_natives_region; - return g_natives_pf; + const OpenedFileMap::mapped_type& opened = + OpenFileIfNecessary(kNativesFileName); + *region_out = opened.second; + return opened.first; } // static base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses( base::MemoryMappedFile::Region* region_out) { - OpenSnapshotFileIfNecessary(); - *region_out = g_snapshot_region; - return g_snapshot_pf; + const OpenedFileMap::mapped_type& opened = + OpenFileIfNecessary(kSnapshotFileName); + *region_out = opened.second; + return opened.first; } + +#if defined(OS_ANDROID) +// static +base::PlatformFile V8Initializer::GetOpenNativesFileForChildProcesses( + base::MemoryMappedFile::Region* region_out, + bool abi_32_bit) { + const char* natives_file = + abi_32_bit ? kNativesFileName32 : kNativesFileName64; + const OpenedFileMap::mapped_type& opened = OpenFileIfNecessary(natives_file); + *region_out = opened.second; + return opened.first; +} + +// static +base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses( + base::MemoryMappedFile::Region* region_out, + bool abi_32_bit) { + const char* snapshot_file = + abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64; + const OpenedFileMap::mapped_type& opened = OpenFileIfNecessary(snapshot_file); + *region_out = opened.second; + return opened.first; +} +#endif // defined(OS_ANDROID) #endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) // static @@ -423,4 +461,20 @@ } } +#if defined(OS_ANDROID) +// static +base::FilePath V8Initializer::GetNativesFilePath(bool abi_32_bit) { + base::FilePath path; + GetV8FilePath(abi_32_bit ? kNativesFileName32 : kNativesFileName64, &path); + return path; +} + +// static +base::FilePath V8Initializer::GetSnapshotFilePath(bool abi_32_bit) { + base::FilePath path; + GetV8FilePath(abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64, &path); + return path; +} +#endif // defined(OS_ANDROID) + } // namespace gin
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h index dcb5329..4c03480 100644 --- a/gin/v8_initializer.h +++ b/gin/v8_initializer.h
@@ -65,6 +65,19 @@ // Will return -1 if the file does not exist. static base::PlatformFile GetOpenSnapshotFileForChildProcesses( base::MemoryMappedFile::Region* region_out); + +#if defined(OS_ANDROID) + static base::PlatformFile GetOpenNativesFileForChildProcesses( + base::MemoryMappedFile::Region* region_out, + bool abi_32_bit); + static base::PlatformFile GetOpenSnapshotFileForChildProcesses( + base::MemoryMappedFile::Region* region_out, + bool abi_32_bit); + + static base::FilePath GetNativesFilePath(bool abi_32_bit); + static base::FilePath GetSnapshotFilePath(bool abi_32_bit); +#endif + #endif // V8_USE_EXTERNAL_STARTUP_DATA };
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 52cbed15..137516f 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -2233,16 +2233,6 @@ '5', ], }, - 'FalseOnly': { - 'type': 'GLboolean', - 'is_complete': True, - 'valid': [ - 'false', - ], - 'invalid': [ - 'true', - ], - }, 'ResetStatus': { 'type': 'GLenum', 'is_complete': True, @@ -3861,6 +3851,7 @@ 'type': 'PUTn', 'count': 4, 'decoder_func': 'DoUniformMatrix2fv', + 'unit_test': False, }, 'UniformMatrix2x3fv': { 'type': 'PUTn', @@ -3878,6 +3869,7 @@ 'type': 'PUTn', 'count': 9, 'decoder_func': 'DoUniformMatrix3fv', + 'unit_test': False, }, 'UniformMatrix3x2fv': { 'type': 'PUTn', @@ -3895,6 +3887,7 @@ 'type': 'PUTn', 'count': 16, 'decoder_func': 'DoUniformMatrix4fv', + 'unit_test': False, }, 'UniformMatrix4x2fv': { 'type': 'PUTn', @@ -8980,8 +8973,7 @@ class EnumBaseArgument(Argument): - """Base class for EnumArgument, IntArgument, BitfieldArgument, and - ValidatedBoolArgument.""" + """Base class for EnumArgument, IntArgument, and BitfieldArgument.""" def __init__(self, name, gl_type, type, gl_error): Argument.__init__(self, name, gl_type) @@ -9103,21 +9095,6 @@ EnumBaseArgument.__init__(self, name, "GLint", type, "GL_INVALID_VALUE") -class ValidatedBoolArgument(EnumBaseArgument): - """A class for a GLboolean argument that can only accept specific values. - - For example glUniformMatrix takes a GLboolean for it's transpose but it - must be false. - """ - - def __init__(self, name, type): - EnumBaseArgument.__init__(self, name, "GLboolean", type, "GL_INVALID_VALUE") - - def GetLogArg(self): - """Overridden from Argument.""" - return 'GLES2Util::GetStringBool(%s)' % self.name - - class BitFieldArgument(EnumBaseArgument): """A class for a GLbitfield argument that can only accept specific values. @@ -10112,8 +10089,6 @@ return EnumArgument(arg_name, arg_type) elif t.startswith('GLbitfield') and t != 'GLbitfield': return BitFieldArgument(arg_name, arg_type) - elif t.startswith('GLboolean') and t != 'GLboolean': - return ValidatedBoolArgument(arg_name, arg_type) elif t.startswith('GLboolean'): return BoolArgument(arg_name, arg_type) elif t.startswith('GLintUniformLocation'):
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index b75d8ec3..8dd89f1 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -1880,6 +1880,7 @@ void UniformMatrix2fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix2fvImmediate::ComputeSize(count); @@ -1887,12 +1888,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix2fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix2x3fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix2x3fvImmediate::ComputeSize(count); @@ -1900,12 +1902,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix2x3fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix2x4fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix2x4fvImmediate::ComputeSize(count); @@ -1913,12 +1916,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix2x4fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix3fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix3fvImmediate::ComputeSize(count); @@ -1926,12 +1930,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix3fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix3x2fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix3x2fvImmediate::ComputeSize(count); @@ -1939,12 +1944,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix3x2fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix3x4fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix3x4fvImmediate::ComputeSize(count); @@ -1952,12 +1958,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix3x4fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix4fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix4fvImmediate::ComputeSize(count); @@ -1965,12 +1972,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix4fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix4x2fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix4x2fvImmediate::ComputeSize(count); @@ -1978,12 +1986,13 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix4x2fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } } void UniformMatrix4x3fvImmediate(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { const uint32_t size = gles2::cmds::UniformMatrix4x3fvImmediate::ComputeSize(count); @@ -1991,7 +2000,7 @@ GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix4x3fvImmediate>( size); if (c) { - c->Init(location, count, value); + c->Init(location, count, transpose, value); } }
diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index a506897e..4ed0561 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -2414,12 +2414,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix2fvImmediate(location, count, value); + helper_->UniformMatrix2fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2444,12 +2439,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix2x3fvImmediate(location, count, value); + helper_->UniformMatrix2x3fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2475,12 +2465,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix2x4fvImmediate(location, count, value); + helper_->UniformMatrix2x4fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2507,12 +2492,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix3fvImmediate(location, count, value); + helper_->UniformMatrix3fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2537,12 +2517,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix3x2fvImmediate(location, count, value); + helper_->UniformMatrix3x2fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2570,12 +2545,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix3x4fvImmediate(location, count, value); + helper_->UniformMatrix3x4fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2605,12 +2575,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix4fvImmediate(location, count, value); + helper_->UniformMatrix4fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2636,12 +2601,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix4x2fvImmediate(location, count, value); + helper_->UniformMatrix4x2fvImmediate(location, count, transpose, value); CheckGLError(); } @@ -2669,12 +2629,7 @@ SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", "count < 0"); return; } - if (transpose != false) { - SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", - "transpose GL_INVALID_VALUE"); - return; - } - helper_->UniformMatrix4x3fvImmediate(location, count, value); + helper_->UniformMatrix4x3fvImmediate(location, count, transpose, value); CheckGLError(); }
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index bd1ebab..13bd0b86 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
@@ -2158,21 +2158,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix2fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix2fvInvalidConstantArg2) { - GLfloat data[2][4] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 4; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix2fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix2x3fv) { @@ -2188,21 +2176,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix2x3fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix2x3fvInvalidConstantArg2) { - GLfloat data[2][6] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 6; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix2x3fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix2x4fv) { @@ -2218,21 +2194,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix2x4fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix2x4fvInvalidConstantArg2) { - GLfloat data[2][8] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 8; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix2x4fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix3fv) { @@ -2248,21 +2212,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix3fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix3fvInvalidConstantArg2) { - GLfloat data[2][9] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 9; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix3fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix3x2fv) { @@ -2278,21 +2230,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix3x2fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix3x2fvInvalidConstantArg2) { - GLfloat data[2][6] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 6; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix3x2fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix3x4fv) { @@ -2308,21 +2248,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix3x4fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix3x4fvInvalidConstantArg2) { - GLfloat data[2][12] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 12; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix3x4fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix4fv) { @@ -2338,21 +2266,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix4fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix4fvInvalidConstantArg2) { - GLfloat data[2][16] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 16; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix4fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix4x2fv) { @@ -2368,21 +2284,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix4x2fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix4x2fvInvalidConstantArg2) { - GLfloat data[2][8] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 8; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix4x2fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UniformMatrix4x3fv) { @@ -2398,21 +2302,9 @@ data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj); } } - expected.cmd.Init(1, 2, &data[0][0]); - gl_->UniformMatrix4x3fv(1, 2, false, &data[0][0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, UniformMatrix4x3fvInvalidConstantArg2) { - GLfloat data[2][12] = {{0}}; - for (int ii = 0; ii < 2; ++ii) { - for (int jj = 0; jj < 12; ++jj) { - data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj); - } - } + expected.cmd.Init(1, 2, true, &data[0][0]); gl_->UniformMatrix4x3fv(1, 2, true, &data[0][0]); - EXPECT_TRUE(NoCommandsWritten()); - EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } TEST_F(GLES2ImplementationTest, UseProgram) {
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index f6de90d7..bbf73e1 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -198,15 +198,15 @@ GL_APICALL void GL_APIENTRY glUniform4ui (GLintUniformLocation location, GLuint x, GLuint y, GLuint z, GLuint w); GL_APICALL void GL_APIENTRY glUniform4uiv (GLintUniformLocation location, GLsizeiNotNegative count, const GLuint* v); GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLidProgram program, GLuint index, GLuint binding); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLintUniformLocation location, GLsizeiNotNegative count, GLbooleanFalseOnly transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLintUniformLocation location, GLsizeiNotNegative count, GLboolean transpose, const GLfloat* value); GL_APICALL void GL_APIENTRY glUseProgram (GLidZeroProgram program); GL_APICALL void GL_APIENTRY glValidateProgram (GLidProgram program); GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index 556efeb..7d678ca 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -9505,15 +9505,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9521,17 +9529,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix2fvImmediate) == 12, - "size of UniformMatrix2fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix2fvImmediate) == 16, + "size of UniformMatrix2fvImmediate should be 16"); static_assert(offsetof(UniformMatrix2fvImmediate, header) == 0, "offset of UniformMatrix2fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix2fvImmediate, location) == 4, "offset of UniformMatrix2fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix2fvImmediate, count) == 8, "offset of UniformMatrix2fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix2fvImmediate, transpose) == 12, + "offset of UniformMatrix2fvImmediate transpose should be 12"); struct UniformMatrix2x3fvImmediate { typedef UniformMatrix2x3fvImmediate ValueType; @@ -9552,15 +9562,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9568,17 +9586,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix2x3fvImmediate) == 12, - "size of UniformMatrix2x3fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix2x3fvImmediate) == 16, + "size of UniformMatrix2x3fvImmediate should be 16"); static_assert(offsetof(UniformMatrix2x3fvImmediate, header) == 0, "offset of UniformMatrix2x3fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix2x3fvImmediate, location) == 4, "offset of UniformMatrix2x3fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix2x3fvImmediate, count) == 8, "offset of UniformMatrix2x3fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix2x3fvImmediate, transpose) == 12, + "offset of UniformMatrix2x3fvImmediate transpose should be 12"); struct UniformMatrix2x4fvImmediate { typedef UniformMatrix2x4fvImmediate ValueType; @@ -9599,15 +9619,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9615,17 +9643,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix2x4fvImmediate) == 12, - "size of UniformMatrix2x4fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix2x4fvImmediate) == 16, + "size of UniformMatrix2x4fvImmediate should be 16"); static_assert(offsetof(UniformMatrix2x4fvImmediate, header) == 0, "offset of UniformMatrix2x4fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix2x4fvImmediate, location) == 4, "offset of UniformMatrix2x4fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix2x4fvImmediate, count) == 8, "offset of UniformMatrix2x4fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix2x4fvImmediate, transpose) == 12, + "offset of UniformMatrix2x4fvImmediate transpose should be 12"); struct UniformMatrix3fvImmediate { typedef UniformMatrix3fvImmediate ValueType; @@ -9646,15 +9676,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9662,17 +9700,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix3fvImmediate) == 12, - "size of UniformMatrix3fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix3fvImmediate) == 16, + "size of UniformMatrix3fvImmediate should be 16"); static_assert(offsetof(UniformMatrix3fvImmediate, header) == 0, "offset of UniformMatrix3fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix3fvImmediate, location) == 4, "offset of UniformMatrix3fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix3fvImmediate, count) == 8, "offset of UniformMatrix3fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix3fvImmediate, transpose) == 12, + "offset of UniformMatrix3fvImmediate transpose should be 12"); struct UniformMatrix3x2fvImmediate { typedef UniformMatrix3x2fvImmediate ValueType; @@ -9693,15 +9733,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9709,17 +9757,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix3x2fvImmediate) == 12, - "size of UniformMatrix3x2fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix3x2fvImmediate) == 16, + "size of UniformMatrix3x2fvImmediate should be 16"); static_assert(offsetof(UniformMatrix3x2fvImmediate, header) == 0, "offset of UniformMatrix3x2fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix3x2fvImmediate, location) == 4, "offset of UniformMatrix3x2fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix3x2fvImmediate, count) == 8, "offset of UniformMatrix3x2fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix3x2fvImmediate, transpose) == 12, + "offset of UniformMatrix3x2fvImmediate transpose should be 12"); struct UniformMatrix3x4fvImmediate { typedef UniformMatrix3x4fvImmediate ValueType; @@ -9740,15 +9790,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9756,17 +9814,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix3x4fvImmediate) == 12, - "size of UniformMatrix3x4fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix3x4fvImmediate) == 16, + "size of UniformMatrix3x4fvImmediate should be 16"); static_assert(offsetof(UniformMatrix3x4fvImmediate, header) == 0, "offset of UniformMatrix3x4fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix3x4fvImmediate, location) == 4, "offset of UniformMatrix3x4fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix3x4fvImmediate, count) == 8, "offset of UniformMatrix3x4fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix3x4fvImmediate, transpose) == 12, + "offset of UniformMatrix3x4fvImmediate transpose should be 12"); struct UniformMatrix4fvImmediate { typedef UniformMatrix4fvImmediate ValueType; @@ -9787,15 +9847,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9803,17 +9871,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix4fvImmediate) == 12, - "size of UniformMatrix4fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix4fvImmediate) == 16, + "size of UniformMatrix4fvImmediate should be 16"); static_assert(offsetof(UniformMatrix4fvImmediate, header) == 0, "offset of UniformMatrix4fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix4fvImmediate, location) == 4, "offset of UniformMatrix4fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix4fvImmediate, count) == 8, "offset of UniformMatrix4fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix4fvImmediate, transpose) == 12, + "offset of UniformMatrix4fvImmediate transpose should be 12"); struct UniformMatrix4x2fvImmediate { typedef UniformMatrix4x2fvImmediate ValueType; @@ -9834,15 +9904,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9850,17 +9928,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix4x2fvImmediate) == 12, - "size of UniformMatrix4x2fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix4x2fvImmediate) == 16, + "size of UniformMatrix4x2fvImmediate should be 16"); static_assert(offsetof(UniformMatrix4x2fvImmediate, header) == 0, "offset of UniformMatrix4x2fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix4x2fvImmediate, location) == 4, "offset of UniformMatrix4x2fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix4x2fvImmediate, count) == 8, "offset of UniformMatrix4x2fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix4x2fvImmediate, transpose) == 12, + "offset of UniformMatrix4x2fvImmediate transpose should be 12"); struct UniformMatrix4x3fvImmediate { typedef UniformMatrix4x3fvImmediate ValueType; @@ -9881,15 +9961,23 @@ header.SetCmdByTotalSize<ValueType>(ComputeSize(count)); } - void Init(GLint _location, GLsizei _count, const GLfloat* _value) { + void Init(GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { SetHeader(_count); location = _location; count = _count; + transpose = _transpose; memcpy(ImmediateDataAddress(this), _value, ComputeDataSize(_count)); } - void* Set(void* cmd, GLint _location, GLsizei _count, const GLfloat* _value) { - static_cast<ValueType*>(cmd)->Init(_location, _count, _value); + void* Set(void* cmd, + GLint _location, + GLsizei _count, + GLboolean _transpose, + const GLfloat* _value) { + static_cast<ValueType*>(cmd)->Init(_location, _count, _transpose, _value); const uint32_t size = ComputeSize(_count); return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); } @@ -9897,17 +9985,19 @@ gpu::CommandHeader header; int32_t location; int32_t count; - static const uint32_t transpose = false; + uint32_t transpose; }; -static_assert(sizeof(UniformMatrix4x3fvImmediate) == 12, - "size of UniformMatrix4x3fvImmediate should be 12"); +static_assert(sizeof(UniformMatrix4x3fvImmediate) == 16, + "size of UniformMatrix4x3fvImmediate should be 16"); static_assert(offsetof(UniformMatrix4x3fvImmediate, header) == 0, "offset of UniformMatrix4x3fvImmediate header should be 0"); static_assert(offsetof(UniformMatrix4x3fvImmediate, location) == 4, "offset of UniformMatrix4x3fvImmediate location should be 4"); static_assert(offsetof(UniformMatrix4x3fvImmediate, count) == 8, "offset of UniformMatrix4x3fvImmediate count should be 8"); +static_assert(offsetof(UniformMatrix4x3fvImmediate, transpose) == 12, + "offset of UniformMatrix4x3fvImmediate transpose should be 12"); struct UseProgram { typedef UseProgram ValueType;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index 6d67e4c..19d86ace 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -3025,13 +3025,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 4; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3057,13 +3058,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 6; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x3fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3093,13 +3095,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 8; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix2x4fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3131,13 +3134,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 9; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3163,13 +3167,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 6; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x2fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3207,13 +3212,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 12; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix3x4fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3259,13 +3265,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 16; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3295,13 +3302,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 8; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x2fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); } @@ -3339,13 +3347,14 @@ const GLsizei kNumElements = 2; const size_t kExpectedCmdSize = sizeof(cmd) + kNumElements * sizeof(GLfloat) * 12; - void* next_cmd = - cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), data); + void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(1), static_cast<GLsizei>(2), + static_cast<GLboolean>(3), data); EXPECT_EQ(static_cast<uint32_t>(cmds::UniformMatrix4x3fvImmediate::kCmdId), cmd.header.command); EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u); EXPECT_EQ(static_cast<GLint>(1), cmd.location); EXPECT_EQ(static_cast<GLsizei>(2), cmd.count); + EXPECT_EQ(static_cast<GLboolean>(3), cmd.transpose); CheckBytesWrittenMatchesExpectedSize( next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data))); }
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 75d22e0..81ce57d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -7380,6 +7380,11 @@ const GLfloat* value) { GLenum type = 0; GLint real_location = -1; + if (transpose && !unsafe_es3_apis_enabled()) { + LOCAL_SET_GL_ERROR( + GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose not FALSE"); + return; + } if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix2fv", Program::kUniformMatrix2f, @@ -7396,6 +7401,11 @@ const GLfloat* value) { GLenum type = 0; GLint real_location = -1; + if (transpose && !unsafe_es3_apis_enabled()) { + LOCAL_SET_GL_ERROR( + GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose not FALSE"); + return; + } if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix3fv", Program::kUniformMatrix3f, @@ -7412,6 +7422,11 @@ const GLfloat* value) { GLenum type = 0; GLint real_location = -1; + if (transpose && !unsafe_es3_apis_enabled()) { + LOCAL_SET_GL_ERROR( + GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose not FALSE"); + return; + } if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", Program::kUniformMatrix4f,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc index df51b99..29636c8 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
@@ -66,6 +66,9 @@ EXPECT_CALL(*gl_, Uniform2uiv(1, _, _)).Times(AnyNumber()); EXPECT_CALL(*gl_, Uniform3uiv(1, _, _)).Times(AnyNumber()); EXPECT_CALL(*gl_, Uniform4uiv(1, _, _)).Times(AnyNumber()); + EXPECT_CALL(*gl_, UniformMatrix2fv(1, _, _, _)).Times(AnyNumber()); + EXPECT_CALL(*gl_, UniformMatrix3fv(1, _, _, _)).Times(AnyNumber()); + EXPECT_CALL(*gl_, UniformMatrix4fv(1, _, _, _)).Times(AnyNumber()); EXPECT_CALL(*gl_, UniformMatrix2x3fv(1, _, _, _)).Times(AnyNumber()); EXPECT_CALL(*gl_, UniformMatrix2x4fv(1, _, _, _)).Times(AnyNumber()); EXPECT_CALL(*gl_, UniformMatrix3x2fv(1, _, _, _)).Times(AnyNumber()); @@ -242,7 +245,7 @@ *GetImmediateAs<cmds::UniformMatrix2fvImmediate>(); GLfloat data[2][2 * 2] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -253,7 +256,7 @@ cmds::UniformMatrix3fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix3fvImmediate>(); GLfloat data[2][3 * 3] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -264,12 +267,45 @@ cmds::UniformMatrix4fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix4fvImmediate>(); GLfloat data[2][4 * 4] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); } + if (!es3_enabled) { + { + valid_uniform = accepts_apis & Program::kUniformMatrix2f; + cmds::UniformMatrix2fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix2fvImmediate>(); + GLfloat data[2][2 * 2] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix3f; + cmds::UniformMatrix3fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix3fvImmediate>(); + GLfloat data[2][3 * 3] = {{0.0f}}; + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix4f; + cmds::UniformMatrix4fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix4fvImmediate>(); + GLfloat data[2][4 * 4] = {{0.0f}}; + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); + } + } + if (es3_enabled) { { valid_uniform = accepts_apis & Program::kUniform1ui; @@ -357,7 +393,7 @@ *GetImmediateAs<cmds::UniformMatrix2x3fvImmediate>(); GLfloat data[2][2 * 3] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -369,7 +405,7 @@ *GetImmediateAs<cmds::UniformMatrix2x4fvImmediate>(); GLfloat data[2][2 * 4] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -381,7 +417,7 @@ *GetImmediateAs<cmds::UniformMatrix3x2fvImmediate>(); GLfloat data[2][3 * 2] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -393,7 +429,7 @@ *GetImmediateAs<cmds::UniformMatrix3x4fvImmediate>(); GLfloat data[2][3 * 4] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -405,7 +441,7 @@ *GetImmediateAs<cmds::UniformMatrix4x2fvImmediate>(); GLfloat data[2][4 * 2] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError()); @@ -417,7 +453,113 @@ *GetImmediateAs<cmds::UniformMatrix4x3fvImmediate>(); GLfloat data[2][4 * 3] = {{0.0f}}; - cmd.Init(1, 2, &data[0][0]); + cmd.Init(1, 2, false, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix2f; + cmds::UniformMatrix2fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix2fvImmediate>(); + GLfloat data[2][2 * 2] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix3f; + cmds::UniformMatrix3fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix3fvImmediate>(); + GLfloat data[2][3 * 3] = {{0.0f}}; + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix4f; + cmds::UniformMatrix4fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix4fvImmediate>(); + GLfloat data[2][4 * 4] = {{0.0f}}; + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix2x3f; + cmds::UniformMatrix2x3fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix2x3fvImmediate>(); + GLfloat data[2][2 * 3] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix2x4f; + cmds::UniformMatrix2x4fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix2x4fvImmediate>(); + GLfloat data[2][2 * 4] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix3x2f; + cmds::UniformMatrix3x2fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix3x2fvImmediate>(); + GLfloat data[2][3 * 2] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix3x4f; + cmds::UniformMatrix3x4fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix3x4fvImmediate>(); + GLfloat data[2][3 * 4] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix4x2f; + cmds::UniformMatrix4x2fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix4x2fvImmediate>(); + GLfloat data[2][4 * 2] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); + EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, + GetGLError()); + } + + { + valid_uniform = accepts_apis & Program::kUniformMatrix4x3f; + cmds::UniformMatrix4x3fvImmediate& cmd = + *GetImmediateAs<cmds::UniformMatrix4x3fvImmediate>(); + GLfloat data[2][4 * 3] = {{0.0f}}; + + cmd.Init(1, 2, true, &data[0][0]); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(data))); EXPECT_EQ(valid_uniform ? GL_NO_ERROR : GL_INVALID_OPERATION, GetGLError());
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h index 8eb40867..f1241ea7 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h
@@ -1445,32 +1445,17 @@ EXPECT_EQ(GL_NO_ERROR, GetGLError()); } -TEST_P(GLES2DecoderTest2, UniformMatrix2fvImmediateValidArgs) { - cmds::UniformMatrix2fvImmediate& cmd = - *GetImmediateAs<cmds::UniformMatrix2fvImmediate>(); - EXPECT_CALL(*gl_, - UniformMatrix2fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); - SpecializedSetup<cmds::UniformMatrix2fvImmediate, 0>(true); - GLfloat temp[4 * 2] = { - 0, - }; - cmd.Init(1, 2, &temp[0]); - EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} - TEST_P(GLES2DecoderTest2, UniformMatrix2x3fvImmediateValidArgs) { cmds::UniformMatrix2x3fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix2x3fvImmediate>(); EXPECT_CALL(*gl_, - UniformMatrix2x3fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); + UniformMatrix2x3fv(1, 2, true, reinterpret_cast<GLfloat*>( + ImmediateDataAddress(&cmd)))); SpecializedSetup<cmds::UniformMatrix2x3fvImmediate, 0>(true); GLfloat temp[6 * 2] = { 0, }; - cmd.Init(1, 2, &temp[0]); + cmd.Init(1, 2, true, &temp[0]); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); EXPECT_EQ(GL_NO_ERROR, GetGLError());
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h index e8b9eb6..9045f5c 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
@@ -16,13 +16,13 @@ cmds::UniformMatrix2x4fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix2x4fvImmediate>(); EXPECT_CALL(*gl_, - UniformMatrix2x4fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); + UniformMatrix2x4fv(1, 2, true, reinterpret_cast<GLfloat*>( + ImmediateDataAddress(&cmd)))); SpecializedSetup<cmds::UniformMatrix2x4fvImmediate, 0>(true); GLfloat temp[8 * 2] = { 0, }; - cmd.Init(1, 2, &temp[0]); + cmd.Init(1, 2, true, &temp[0]); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); EXPECT_EQ(GL_NO_ERROR, GetGLError()); @@ -30,32 +30,17 @@ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp))); } -TEST_P(GLES2DecoderTest3, UniformMatrix3fvImmediateValidArgs) { - cmds::UniformMatrix3fvImmediate& cmd = - *GetImmediateAs<cmds::UniformMatrix3fvImmediate>(); - EXPECT_CALL(*gl_, - UniformMatrix3fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); - SpecializedSetup<cmds::UniformMatrix3fvImmediate, 0>(true); - GLfloat temp[9 * 2] = { - 0, - }; - cmd.Init(1, 2, &temp[0]); - EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} - TEST_P(GLES2DecoderTest3, UniformMatrix3x2fvImmediateValidArgs) { cmds::UniformMatrix3x2fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix3x2fvImmediate>(); EXPECT_CALL(*gl_, - UniformMatrix3x2fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); + UniformMatrix3x2fv(1, 2, true, reinterpret_cast<GLfloat*>( + ImmediateDataAddress(&cmd)))); SpecializedSetup<cmds::UniformMatrix3x2fvImmediate, 0>(true); GLfloat temp[6 * 2] = { 0, }; - cmd.Init(1, 2, &temp[0]); + cmd.Init(1, 2, true, &temp[0]); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); EXPECT_EQ(GL_NO_ERROR, GetGLError()); @@ -67,13 +52,13 @@ cmds::UniformMatrix3x4fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix3x4fvImmediate>(); EXPECT_CALL(*gl_, - UniformMatrix3x4fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); + UniformMatrix3x4fv(1, 2, true, reinterpret_cast<GLfloat*>( + ImmediateDataAddress(&cmd)))); SpecializedSetup<cmds::UniformMatrix3x4fvImmediate, 0>(true); GLfloat temp[12 * 2] = { 0, }; - cmd.Init(1, 2, &temp[0]); + cmd.Init(1, 2, true, &temp[0]); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); EXPECT_EQ(GL_NO_ERROR, GetGLError()); @@ -81,32 +66,17 @@ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp))); } -TEST_P(GLES2DecoderTest3, UniformMatrix4fvImmediateValidArgs) { - cmds::UniformMatrix4fvImmediate& cmd = - *GetImmediateAs<cmds::UniformMatrix4fvImmediate>(); - EXPECT_CALL(*gl_, - UniformMatrix4fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); - SpecializedSetup<cmds::UniformMatrix4fvImmediate, 0>(true); - GLfloat temp[16 * 2] = { - 0, - }; - cmd.Init(1, 2, &temp[0]); - EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} - TEST_P(GLES2DecoderTest3, UniformMatrix4x2fvImmediateValidArgs) { cmds::UniformMatrix4x2fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix4x2fvImmediate>(); EXPECT_CALL(*gl_, - UniformMatrix4x2fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); + UniformMatrix4x2fv(1, 2, true, reinterpret_cast<GLfloat*>( + ImmediateDataAddress(&cmd)))); SpecializedSetup<cmds::UniformMatrix4x2fvImmediate, 0>(true); GLfloat temp[8 * 2] = { 0, }; - cmd.Init(1, 2, &temp[0]); + cmd.Init(1, 2, true, &temp[0]); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); EXPECT_EQ(GL_NO_ERROR, GetGLError()); @@ -118,13 +88,13 @@ cmds::UniformMatrix4x3fvImmediate& cmd = *GetImmediateAs<cmds::UniformMatrix4x3fvImmediate>(); EXPECT_CALL(*gl_, - UniformMatrix4x3fv(1, 2, false, reinterpret_cast<GLfloat*>( - ImmediateDataAddress(&cmd)))); + UniformMatrix4x3fv(1, 2, true, reinterpret_cast<GLfloat*>( + ImmediateDataAddress(&cmd)))); SpecializedSetup<cmds::UniformMatrix4x3fvImmediate, 0>(true); GLfloat temp[12 * 2] = { 0, }; - cmd.Init(1, 2, &temp[0]); + cmd.Init(1, 2, true, &temp[0]); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); EXPECT_EQ(GL_NO_ERROR, GetGLError());
diff --git a/ios/chrome/browser/snapshots/snapshot_cache.mm b/ios/chrome/browser/snapshots/snapshot_cache.mm index 7da1d61..b6ad231 100644 --- a/ios/chrome/browser/snapshots/snapshot_cache.mm +++ b/ios/chrome/browser/snapshots/snapshot_cache.mm
@@ -389,8 +389,8 @@ - (void)handleLowMemory { DCHECK(!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled()); DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); - NSMutableDictionary* dictionary = - [[NSMutableDictionary alloc] initWithCapacity:2]; + base::scoped_nsobject<NSMutableDictionary> dictionary( + [[NSMutableDictionary alloc] initWithCapacity:2]); for (NSString* sessionID in pinnedIDs_) { UIImage* image = nil; if (lruCache_) @@ -403,9 +403,10 @@ if (lruCache_) { [lruCache_ removeAllObjects]; for (NSString* sessionID in pinnedIDs_) - [lruCache_ setObject:dictionary[sessionID] forKey:sessionID]; + [lruCache_ setObject:[dictionary objectForKey:sessionID] + forKey:sessionID]; } else { - imageDictionary_.reset(dictionary); + imageDictionary_ = dictionary; } }
diff --git a/ios/crnet/test/crnet_http_tests.mm b/ios/crnet/test/crnet_http_tests.mm index ab24b3a..af74ec0 100644 --- a/ios/crnet/test/crnet_http_tests.mm +++ b/ios/crnet/test/crnet_http_tests.mm
@@ -194,21 +194,6 @@ GURL server_root_; }; -TEST_F(HttpTest, NSURLConnectionReceivesData) { - const char kData[] = "foobar"; - const char kPath[] = "/foo"; - RegisterPathText(kPath, kData); - StartWebServer(); - - NSURL* url = net::NSURLWithGURL(GetURL(kPath)); - NSURLRequest* req = [NSURLRequest requestWithURL:url]; - NSURLResponse* resp = nil; - NSData* received = [NSURLConnection sendSynchronousRequest:req - returningResponse:&resp - error:nullptr]; - EXPECT_EQ(0, memcmp([received bytes], kData, sizeof(kData))); -} - TEST_F(HttpTest, NSURLSessionReceivesData) { const char kPath[] = "/foo"; const char kData[] = "foobar"; @@ -231,13 +216,10 @@ }); StartWebServer(); NSURL* url = net::NSURLWithGURL(GetURL(kPath)); - NSURLRequest* req = [NSURLRequest requestWithURL:url]; - NSURLResponse* resp = nil; - NSError* error = nil; - NSData* received = [NSURLConnection sendSynchronousRequest:req - returningResponse:&resp - error:&error]; - DCHECK(received); + NSURLSessionDataTask* task = [session_ dataTaskWithURL:url]; + StartDataTaskAndWaitForCompletion(task); + EXPECT_EQ(nil, [delegate_ error]); + EXPECT_TRUE([delegate_ receivedBytes]); } // TODO(ellyjones): There needs to be a test that enabling SDCH works, but
diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc index e27ec5d..ed1e459 100644 --- a/ipc/mojo/ipc_channel_mojo_unittest.cc +++ b/ipc/mojo/ipc_channel_mojo_unittest.cc
@@ -150,7 +150,8 @@ }; // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_ConnectedFromClient DISABLED_ConnectedFromClient #else #define MAYBE_ConnectedFromClient ConnectedFromClient @@ -265,7 +266,8 @@ } // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_SendFailWithPendingMessages DISABLED_SendFailWithPendingMessages #else #define MAYBE_SendFailWithPendingMessages SendFailWithPendingMessages @@ -412,7 +414,8 @@ }; // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_SendMessagePipe DISABLED_SendMessagePipe #else #define MAYBE_SendMessagePipe SendMessagePipe @@ -509,7 +512,8 @@ } // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_ParamTraitValidMessagePipe DISABLED_ParamTraitValidMessagePipe #else #define MAYBE_ParamTraitValidMessagePipe ParamTraitValidMessagePipe @@ -543,7 +547,8 @@ } // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_ParamTraitInvalidMessagePipe DISABLED_ParamTraitInvalidMessagePipe #else #define MAYBE_ParamTraitInvalidMessagePipe ParamTraitInvalidMessagePipe @@ -574,7 +579,13 @@ return 0; } -TEST_F(IPCChannelMojoTest, SendFailAfterClose) { +// Times out on Linux. crbug.com/585784 +#if defined(OS_LINUX) +#define MAYBE_SendFailAfterClose DISABLED_SendFailAfterClose +#else +#define MAYBE_SendFailAfterClose SendFailAfterClose +#endif +TEST_F(IPCChannelMojoTest, MAYBE_SendFailAfterClose) { InitWithMojo("IPCChannelMojoTestSendOkClient"); ListenerThatExpectsOK listener; @@ -643,7 +654,13 @@ } }; -TEST_F(IPCChannelMojoDeadHandleTest, InvalidClientHandle) { +// Times out on Linux. crbug.com/585784 +#if defined(OS_LINUX) +#define MAYBE_InvalidClientHandle DISABLED_InvalidClientHandle +#else +#define MAYBE_InvalidClientHandle InvalidClientHandle +#endif +TEST_F(IPCChannelMojoDeadHandleTest, MAYBE_InvalidClientHandle) { // Any client type is fine as it is going to be killed anyway. InitWithMojo("IPCChannelMojoTestDoNothingClient"); @@ -706,7 +723,8 @@ }; // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_SendPlatformHandle DISABLED_SendPlatformHandle #else #define MAYBE_SendPlatformHandle SendPlatformHandle @@ -769,7 +787,8 @@ }; // Times out on Android; see http://crbug.com/502290 -#if defined(OS_ANDROID) +// Times out on Linux. crbug.com/585784 +#if defined(OS_ANDROID) || defined(OS_LINUX) #define MAYBE_SendPlatformHandleAndPipe DISABLED_SendPlatformHandleAndPipe #else #define MAYBE_SendPlatformHandleAndPipe SendPlatformHandleAndPipe @@ -829,7 +848,13 @@ } }; -TEST_F(IPCChannelMojoTest, VerifyGlobalPid) { +// Times out on Linux. crbug.com/585784 +#if defined(OS_LINUX) +#define MAYBE_VerifyGlobalPid DISABLED_VerifyGlobalPid +#else +#define MAYBE_VerifyGlobalPid VerifyGlobalPid +#endif +TEST_F(IPCChannelMojoTest, MAYBE_VerifyGlobalPid) { InitWithMojo("IPCChannelMojoTestVerifyGlobalPidClient"); ListenerThatVerifiesPeerPid listener;
diff --git a/mash/browser_driver/browser_driver_application_delegate.cc b/mash/browser_driver/browser_driver_application_delegate.cc index 98ac6482..3bc7ede 100644 --- a/mash/browser_driver/browser_driver_application_delegate.cc +++ b/mash/browser_driver/browser_driver_application_delegate.cc
@@ -82,7 +82,7 @@ // TODO(beng): find some other way to get the window manager. I don't like // having to specify it by URL because it may differ per display. mus::mojom::AcceleratorRegistrarPtr registrar; - shell_->ConnectToService("mojo:desktop_wm", ®istrar); + shell_->ConnectToInterface("mojo:desktop_wm", ®istrar); if (binding_.is_bound()) binding_.Unbind();
diff --git a/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc index 14ffd164..b8dcbb6 100644 --- a/mash/example/window_type_launcher/window_type_launcher.cc +++ b/mash/example/window_type_launcher/window_type_launcher.cc
@@ -274,7 +274,7 @@ } else if (sender == lock_button_) { mash::shell::mojom::ShellPtr shell; - shell_->ConnectToService("mojo:mash_shell", &shell); + shell_->ConnectToInterface("mojo:mash_shell", &shell); shell->LockScreen(); } else if (sender == widgets_button_) {
diff --git a/mash/screenlock/screenlock.cc b/mash/screenlock/screenlock.cc index df3a0ea0b..86f3bd4 100644 --- a/mash/screenlock/screenlock.cc +++ b/mash/screenlock/screenlock.cc
@@ -60,7 +60,7 @@ void ButtonPressed(views::Button* sender, const ui::Event& event) override { DCHECK_EQ(sender, unlock_button_); mash::shell::mojom::ShellPtr shell; - shell_->ConnectToService("mojo:mash_shell", &shell); + shell_->ConnectToInterface("mojo:mash_shell", &shell); shell->UnlockScreen(); } @@ -81,7 +81,7 @@ tracing_.Initialize(shell, url); mash::shell::mojom::ShellPtr mash_shell; - shell_->ConnectToService("mojo:mash_shell", &mash_shell); + shell_->ConnectToInterface("mojo:mash_shell", &mash_shell); mash_shell->AddScreenlockStateListener( bindings_.CreateInterfacePtrAndBind(this));
diff --git a/mash/shelf/shelf_model.cc b/mash/shelf/shelf_model.cc index 9e7e5937..398094a 100644 --- a/mash/shelf/shelf_model.cc +++ b/mash/shelf/shelf_model.cc
@@ -51,7 +51,7 @@ ShelfModel::ShelfModel(mojo::Shell* shell) : next_id_(1), status_(STATUS_NORMAL), binding_(this) { - shell->ConnectToService("mojo:desktop_wm", &user_window_controller_); + shell->ConnectToInterface("mojo:desktop_wm", &user_window_controller_); user_window_controller_->AddUserWindowObserver( binding_.CreateInterfacePtrAndBind()); }
diff --git a/mash/task_viewer/task_viewer_application_delegate.cc b/mash/task_viewer/task_viewer_application_delegate.cc index ff3f9d3..beb8174 100644 --- a/mash/task_viewer/task_viewer_application_delegate.cc +++ b/mash/task_viewer/task_viewer_application_delegate.cc
@@ -244,7 +244,7 @@ views::WindowManagerConnection::Create(shell); mojo::shell::mojom::ApplicationManagerPtr application_manager; - shell->ConnectToService("mojo:shell", &application_manager); + shell->ConnectToInterface("mojo:shell", &application_manager); mojo::shell::mojom::ApplicationManagerListenerPtr listener; ListenerRequest request = GetProxy(&listener);
diff --git a/mash/wm/accelerator_registrar_apptest.cc b/mash/wm/accelerator_registrar_apptest.cc index 5cdc8b5..f7c31ae 100644 --- a/mash/wm/accelerator_registrar_apptest.cc +++ b/mash/wm/accelerator_registrar_apptest.cc
@@ -72,7 +72,7 @@ protected: void ConnectToRegistrar(AcceleratorRegistrarPtr* registrar) { - shell()->ConnectToService("mojo:desktop_wm", registrar); + shell()->ConnectToInterface("mojo:desktop_wm", registrar); } private:
diff --git a/mash/wm/root_window_controller.cc b/mash/wm/root_window_controller.cc index ab91b75..161d0cc 100644 --- a/mash/wm/root_window_controller.cc +++ b/mash/wm/root_window_controller.cc
@@ -141,7 +141,7 @@ AddAccelerators(); mash::shell::mojom::ShellPtr shell; - app_->shell()->ConnectToService("mojo:mash_shell", &shell); + app_->shell()->ConnectToInterface("mojo:mash_shell", &shell); window_manager_->Initialize(this, std::move(shell)); shadow_controller_.reset(new ShadowController(root->connection()));
diff --git a/mash/wm/window_manager_application.cc b/mash/wm/window_manager_application.cc index 704811d..0650c44 100644 --- a/mash/wm/window_manager_application.cc +++ b/mash/wm/window_manager_application.cc
@@ -110,7 +110,7 @@ tracing_.Initialize(shell, url); mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; - shell_->ConnectToService("mojo:mus", &wm_factory_service); + shell_->ConnectToInterface("mojo:mus", &wm_factory_service); wm_factory_service->SetWindowManagerFactory( window_manager_factory_binding_.CreateInterfacePtrAndBind());
diff --git a/media/mojo/services/android_mojo_media_client.cc b/media/mojo/services/android_mojo_media_client.cc index 8c816f7..58298b44 100644 --- a/media/mojo/services/android_mojo_media_client.cc +++ b/media/mojo/services/android_mojo_media_client.cc
@@ -19,7 +19,7 @@ scoped_ptr<ProvisionFetcher> CreateProvisionFetcher( mojo::InterfaceProvider* service_provider) { interfaces::ProvisionFetcherPtr provision_fetcher_ptr; - mojo::ConnectToService(service_provider, &provision_fetcher_ptr); + mojo::GetInterface(service_provider, &provision_fetcher_ptr); return make_scoped_ptr( new MojoProvisionFetcher(std::move(provision_fetcher_ptr))); }
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc index e4ef262b..77fe5ec 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc
@@ -677,7 +677,7 @@ protected: scoped_ptr<Renderer> CreateRenderer() override { - shell()->ConnectToService("mojo:media", &media_service_factory_); + shell()->ConnectToInterface("mojo:media", &media_service_factory_); interfaces::RendererPtr mojo_renderer; media_service_factory_->CreateRenderer(mojo::GetProxy(&mojo_renderer));
diff --git a/mojo/android/BUILD.gn b/mojo/android/BUILD.gn index 368c7160..f1a94018 100644 --- a/mojo/android/BUILD.gn +++ b/mojo/android/BUILD.gn
@@ -134,6 +134,7 @@ android_apk("mojo_test_apk") { testonly = true + create_dist_ijar = true deps = [ ":mojo_java_unittests", ":mojo_javatests",
diff --git a/mojo/edk/system/message_pipe_unittest.cc b/mojo/edk/system/message_pipe_unittest.cc index 63fd6343..e3ecff3 100644 --- a/mojo/edk/system/message_pipe_unittest.cc +++ b/mojo/edk/system/message_pipe_unittest.cc
@@ -421,7 +421,8 @@ } // Test that sending a data pipe handle across processes doesn't leak resources. -TEST_F(MessagePipeTest, DataPipeConsumerHandlePingPong) { +// Currently times out on multiple platforms. crbug.com/585784 +TEST_F(MessagePipeTest, DISABLED_DataPipeConsumerHandlePingPong) { MojoHandle p, c; EXPECT_EQ(MOJO_RESULT_OK, MojoCreateDataPipe(nullptr, &p, &c)); MojoClose(p); @@ -435,7 +436,8 @@ MojoClose(c); } -TEST_F(MessagePipeTest, DataPipeProducerHandlePingPong) { +// Currently times out on multiple platforms. crbug.com/585784 +TEST_F(MessagePipeTest, DISABLED_DataPipeProducerHandlePingPong) { MojoHandle p, c; EXPECT_EQ(MOJO_RESULT_OK, MojoCreateDataPipe(nullptr, &p, &c)); MojoClose(c); @@ -449,7 +451,7 @@ MojoClose(p); } -TEST_F(MessagePipeTest, SharedBufferHandlePingPong) { +TEST_F(MessagePipeTest, DISABLED_SharedBufferHandlePingPong) { MojoHandle buffer; EXPECT_EQ(MOJO_RESULT_OK, MojoCreateSharedBuffer(nullptr, 1, &buffer));
diff --git a/mojo/edk/system/multiprocess_message_pipe_unittest.cc b/mojo/edk/system/multiprocess_message_pipe_unittest.cc index ece85a1..1b096fb 100644 --- a/mojo/edk/system/multiprocess_message_pipe_unittest.cc +++ b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
@@ -772,7 +772,13 @@ return 0; } -TEST_F(MultiprocessMessagePipeTest, MultiprocessChannelPipe) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_MultiprocessChannelPipe DISABLED_MultiprocessChannelPipe +#else +#define MAYBE_MultiprocessChannelPipe MultiprocessChannelPipe +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_MultiprocessChannelPipe) { RUN_CHILD_ON_PIPE(ChannelEchoClient, h) VerifyEcho(h, "in an interstellar burst"); VerifyEcho(h, "i am back to save the universe"); @@ -797,7 +803,13 @@ return 0; } -TEST_F(MultiprocessMessagePipeTest, PassMessagePipeCrossProcess) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PassMessagePipeCrossProcess DISABLED_PassMessagePipeCrossProcess +#else +#define MAYBE_PassMessagePipeCrossProcess PassMessagePipeCrossProcess +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_PassMessagePipeCrossProcess) { MojoHandle p0, p1; CreateMessagePipe(&p0, &p1); RUN_CHILD_ON_PIPE(EchoServiceClient, h) @@ -854,7 +866,14 @@ return 0; } -TEST_F(MultiprocessMessagePipeTest, PassMoarMessagePipesCrossProcess) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PassMoarMessagePipesCrossProcess \ + DISABLED_PassMoarMessagePipesCrossProcess +#else +#define MAYBE_PassMoarMessagePipesCrossProcess PassMoarMessagePipesCrossProcess +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_PassMoarMessagePipesCrossProcess) { MojoHandle echo_factory_proxy, echo_factory_request; CreateMessagePipe(&echo_factory_proxy, &echo_factory_request); @@ -899,7 +918,14 @@ CloseHandle(echo_proxy_c); } -TEST_F(MultiprocessMessagePipeTest, ChannelPipesWithMultipleChildren) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_ChannelPipesWithMultipleChildren \ + DISABLED_ChannelPipesWithMultipleChildren +#else +#define MAYBE_ChannelPipesWithMultipleChildren ChannelPipesWithMultipleChildren +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_ChannelPipesWithMultipleChildren) { RUN_CHILD_ON_PIPE(ChannelEchoClient, a) RUN_CHILD_ON_PIPE(ChannelEchoClient, b) VerifyEcho(a, "hello child 0"); @@ -929,7 +955,13 @@ EXPECT_EQ("quit", ReadMessage(h)); } -TEST_F(MultiprocessMessagePipeTest, PingPongPipe) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PingPongPipe DISABLED_PingPongPipe +#else +#define MAYBE_PingPongPipe PingPongPipe +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_PingPongPipe) { MojoHandle p0, p1; CreateMessagePipe(&p0, &p1); @@ -1028,7 +1060,13 @@ return 0; } -TEST_F(MultiprocessMessagePipeTest, ChildToChildPipes) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_ChildToChildPipes DISABLED_ChildToChildPipes +#else +#define MAYBE_ChildToChildPipes ChildToChildPipes +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_ChildToChildPipes) { RUN_CHILD_ON_PIPE(CommandDrivenClient, h0) RUN_CHILD_ON_PIPE(CommandDrivenClient, h1) CommandDrivenClientController a(h0); @@ -1053,7 +1091,13 @@ END_CHILD() } -TEST_F(MultiprocessMessagePipeTest, MoreChildToChildPipes) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_MoreChildToChildPipes DISABLED_MoreChildToChildPipes +#else +#define MAYBE_MoreChildToChildPipes MoreChildToChildPipes +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_MoreChildToChildPipes) { RUN_CHILD_ON_PIPE(CommandDrivenClient, h0) RUN_CHILD_ON_PIPE(CommandDrivenClient, h1) RUN_CHILD_ON_PIPE(CommandDrivenClient, h2) @@ -1139,7 +1183,13 @@ MOJO_DEADLINE_INDEFINITE, nullptr)); } -TEST_F(MultiprocessMessagePipeTest, SendPipeThenClosePeer) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_SendPipeThenClosePeer DISABLED_SendPipeThenClosePeer +#else +#define MAYBE_SendPipeThenClosePeer SendPipeThenClosePeer +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_SendPipeThenClosePeer) { RUN_CHILD_ON_PIPE(ReceivePipeWithClosedPeer, h) MojoHandle a, b; CreateMessagePipe(&a, &b); @@ -1190,7 +1240,16 @@ EXPECT_EQ(MOJO_RESULT_OK, MojoClose(application_client)); } -TEST_F(MultiprocessMessagePipeTest, SendPipeWithClosedPeerBetweenChildren) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_SendPipeWithClosedPeerBetweenChildren \ + DISABLED_SendPipeWithClosedPeerBetweenChildren +#else +#define MAYBE_SendPipeWithClosedPeerBetweenChildren \ + SendPipeWithClosedPeerBetweenChildren +#endif +TEST_F(MultiprocessMessagePipeTest, + MAYBE_SendPipeWithClosedPeerBetweenChildren) { RUN_CHILD_ON_PIPE(SendOtherChildPipeWithClosedPeer, kid_a) RUN_CHILD_ON_PIPE(ReceivePipeWithClosedPeerFromOtherChild, kid_b) // Receive an "application request" from the first child and forward it @@ -1206,7 +1265,14 @@ END_CHILD() } -TEST_F(MultiprocessMessagePipeTest, SendClosePeerSend) { + +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_SendClosePeerSend DISABLED_SendClosePeerSend +#else +#define MAYBE_SendClosePeerSend SendClosePeerSend +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_SendClosePeerSend) { MojoHandle a, b; CreateMessagePipe(&a, &b); @@ -1249,7 +1315,13 @@ EXPECT_EQ("quit", ReadMessage(h)); } -TEST_F(MultiprocessMessagePipeTest, WriteCloseSendPeer) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_WriteCloseSendPeer DISABLED_WriteCloseSendPeer +#else +#define MAYBE_WriteCloseSendPeer WriteCloseSendPeer +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_WriteCloseSendPeer) { MojoHandle pipe[2]; CreateMessagePipe(&pipe[0], &pipe[1]); @@ -1289,7 +1361,13 @@ VerifyEcho(pipe.get().value(), "goodbye"); } -TEST_F(MultiprocessMessagePipeTest, BootstrapMessagePipeAsync) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_BootstrapMessagePipeAsync DISABLED_BootstrapMessagePipeAsync +#else +#define MAYBE_BootstrapMessagePipeAsync BootstrapMessagePipeAsync +#endif +TEST_F(MultiprocessMessagePipeTest, MAYBE_BootstrapMessagePipeAsync) { // Tests that new cross-process message pipes can be created synchronously // using asynchronous negotiation over an arbitrary platform channel. RUN_CHILD_ON_PIPE(BootstrapMessagePipeAsyncClient, child)
diff --git a/mojo/edk/system/shared_buffer_unittest.cc b/mojo/edk/system/shared_buffer_unittest.cc index 1ea8aa0..c699d9da3 100644 --- a/mojo/edk/system/shared_buffer_unittest.cc +++ b/mojo/edk/system/shared_buffer_unittest.cc
@@ -62,7 +62,13 @@ EXPECT_EQ("quit", ReadMessage(h)); } -TEST_F(SharedBufferTest, PassSharedBufferCrossProcess) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PassSharedBufferCrossProcess DISABLED_PassSharedBufferCrossProcess +#else +#define MAYBE_PassSharedBufferCrossProcess PassSharedBufferCrossProcess +#endif +TEST_F(SharedBufferTest, MAYBE_PassSharedBufferCrossProcess) { const std::string message = "hello"; MojoHandle b = CreateBuffer(message.size()); @@ -86,7 +92,13 @@ EXPECT_EQ("quit", ReadMessage(h)); } -TEST_F(SharedBufferTest, PassSharedBufferFromChild) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PassSharedBufferFromChild DISABLED_PassSharedBufferFromChild +#else +#define MAYBE_PassSharedBufferFromChild PassSharedBufferFromChild +#endif +TEST_F(SharedBufferTest, MAYBE_PassSharedBufferFromChild) { const std::string message = "hello"; MojoHandle b; RUN_CHILD_ON_PIPE(CreateBufferClient, h) @@ -133,7 +145,14 @@ WriteMessage(h, "ok"); } -TEST_F(SharedBufferTest, PassSharedBufferFromChildToChild) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PassSharedBufferFromChildToChild \ + DISABLED_PassSharedBufferFromChildToChild +#else +#define MAYBE_PassSharedBufferFromChildToChild PassSharedBufferFromChildToChild +#endif +TEST_F(SharedBufferTest, MAYBE_PassSharedBufferFromChildToChild) { const std::string message = "hello"; MojoHandle p0, p1; CreateMessagePipe(&p0, &p1); @@ -197,7 +216,13 @@ END_CHILD() } -TEST_F(SharedBufferTest, PassHandleBetweenCousins) { +#if defined(OS_ANDROID) +// Android multi-process tests are not executing the new process. This is flaky. +#define MAYBE_PassHandleBetweenCousins DISABLED_PassHandleBetweenCousins +#else +#define MAYBE_PassHandleBetweenCousins PassHandleBetweenCousins +#endif +TEST_F(SharedBufferTest, MAYBE_PassHandleBetweenCousins) { const std::string message = "hello"; MojoHandle p0, p1; CreateMessagePipe(&p0, &p1);
diff --git a/mojo/public/cpp/bindings/tests/versioning_apptest.cc b/mojo/public/cpp/bindings/tests/versioning_apptest.cc index 450557a..7c74c45 100644 --- a/mojo/public/cpp/bindings/tests/versioning_apptest.cc +++ b/mojo/public/cpp/bindings/tests/versioning_apptest.cc
@@ -24,7 +24,7 @@ void SetUp() override { ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:versioning_test_service", &database_); + shell()->ConnectToInterface("mojo:versioning_test_service", &database_); } HumanResourceDatabasePtr database_;
diff --git a/mojo/services/network/network_service_delegate.cc b/mojo/services/network/network_service_delegate.cc index 574a143..84334fc 100644 --- a/mojo/services/network/network_service_delegate.cc +++ b/mojo/services/network/network_service_delegate.cc
@@ -97,7 +97,7 @@ // to OpenFileSystem, the entire mojo system hangs to the point where writes // to stderr that previously would have printed to our console aren't. The // apptests are also fairly resistant to being run under gdb on android. - shell_->ConnectToService("mojo:filesystem", &files_); + shell_->ConnectToInterface("mojo:filesystem", &files_); filesystem::FileError error = filesystem::FileError::FAILED; filesystem::DirectoryPtr directory;
diff --git a/mojo/services/network/udp_socket_apptest.cc b/mojo/services/network/udp_socket_apptest.cc index dfc7f3c2..ac800e0 100644 --- a/mojo/services/network/udp_socket_apptest.cc +++ b/mojo/services/network/udp_socket_apptest.cc
@@ -324,7 +324,7 @@ void SetUp() override { ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:network_service", &network_service_); + shell()->ConnectToInterface("mojo:network_service", &network_service_); network_service_->CreateUDPSocket(GetProxy(&socket_)); }
diff --git a/mojo/services/test_service/test_service_impl.cc b/mojo/services/test_service/test_service_impl.cc index 6243407..5582dec 100644 --- a/mojo/services/test_service/test_service_impl.cc +++ b/mojo/services/test_service/test_service_impl.cc
@@ -47,7 +47,7 @@ void TestServiceImpl::ConnectToAppAndGetTime( const mojo::String& app_url, const mojo::Callback<void(int64_t)>& callback) { - shell_->ConnectToService(app_url.get(), &time_service_); + shell_->ConnectToInterface(app_url.get(), &time_service_); if (tracking_) { tracking_->RecordNewRequest(); time_service_->StartTrackingRequests(mojo::Callback<void()>()); @@ -58,7 +58,7 @@ void TestServiceImpl::StartTrackingRequests( const mojo::Callback<void()>& callback) { TestRequestTrackerPtr tracker; - shell_->ConnectToService("mojo:test_request_tracker_app", &tracker); + shell_->ConnectToInterface("mojo:test_request_tracker_app", &tracker); tracking_.reset(new TrackedService(std::move(tracker), Name_, callback)); }
diff --git a/mojo/services/test_service/test_time_service_impl.cc b/mojo/services/test_service/test_time_service_impl.cc index c69673d..ee4028d 100644 --- a/mojo/services/test_service/test_time_service_impl.cc +++ b/mojo/services/test_service/test_time_service_impl.cc
@@ -27,7 +27,7 @@ void TestTimeServiceImpl::StartTrackingRequests( const mojo::Callback<void()>& callback) { TestRequestTrackerPtr tracker; - shell_->ConnectToService("mojo:test_request_tracker_app", &tracker); + shell_->ConnectToInterface("mojo:test_request_tracker_app", &tracker); tracking_.reset(new TrackedService(std::move(tracker), Name_, callback)); }
diff --git a/mojo/shell/application_manager_apptest.cc b/mojo/shell/application_manager_apptest.cc index a725fae..01af33e6 100644 --- a/mojo/shell/application_manager_apptest.cc +++ b/mojo/shell/application_manager_apptest.cc
@@ -91,7 +91,7 @@ void AddListenerAndWaitForApplications() { mojom::ApplicationManagerPtr application_manager; - shell()->ConnectToService("mojo:shell", &application_manager); + shell()->ConnectToInterface("mojo:shell", &application_manager); application_manager->AddListener(binding_.CreateInterfacePtrAndBind()); binding_.WaitForIncomingMethodCall();
diff --git a/mojo/shell/application_manager_apptest_driver.cc b/mojo/shell/application_manager_apptest_driver.cc index 453f3d55..7fe76a0 100644 --- a/mojo/shell/application_manager_apptest_driver.cc +++ b/mojo/shell/application_manager_apptest_driver.cc
@@ -99,7 +99,7 @@ std::move(test_interfaces)); mojo::shell::mojom::ApplicationManagerPtr application_manager; - shell_->ConnectToService("mojo:shell", &application_manager); + shell_->ConnectToInterface("mojo:shell", &application_manager); application_manager->CreateInstanceForHandle( mojo::ScopedHandle(mojo::Handle(pipe.release().value())), "exe:application_manager_apptest_target", std::move(filter),
diff --git a/mojo/shell/application_manager_apptest_target.cc b/mojo/shell/application_manager_apptest_target.cc index e0c23b8..133b547 100644 --- a/mojo/shell/application_manager_apptest_target.cc +++ b/mojo/shell/application_manager_apptest_target.cc
@@ -26,7 +26,7 @@ void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { CreateInstanceForHandleTestPtr service; - shell->ConnectToService("mojo:mojo_shell_apptests", &service); + shell->ConnectToInterface("mojo:mojo_shell_apptests", &service); service->SetTargetID(id); }
diff --git a/mojo/shell/application_package_apptest.cc b/mojo/shell/application_package_apptest.cc index 7d2e43c3d..5b03417 100644 --- a/mojo/shell/application_package_apptest.cc +++ b/mojo/shell/application_package_apptest.cc
@@ -176,7 +176,7 @@ // We need to do this to force the shell to read the test app's manifest and // register aliases. test::mojom::ApplicationPackageApptestServicePtr root_service; - shell()->ConnectToService("mojo:mojo_shell_apptests", &root_service); + shell()->ConnectToInterface("mojo:mojo_shell_apptests", &root_service); base::RunLoop run_loop; std::string root_name; root_service->GetName(base::Bind(&ReceiveName, &root_name, &run_loop)); @@ -187,7 +187,7 @@ // Now subsequent connects to applications provided by the root app will be // resolved correctly. test::mojom::ApplicationPackageApptestServicePtr service_a; - shell()->ConnectToService("mojo:package_test_a", &service_a); + shell()->ConnectToInterface("mojo:package_test_a", &service_a); base::RunLoop run_loop; std::string a_name; service_a->GetName(base::Bind(&ReceiveName, &a_name, &run_loop)); @@ -197,7 +197,7 @@ { test::mojom::ApplicationPackageApptestServicePtr service_b; - shell()->ConnectToService("mojo:package_test_b", &service_b); + shell()->ConnectToInterface("mojo:package_test_b", &service_b); base::RunLoop run_loop; std::string b_name; service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop));
diff --git a/mojo/shell/capability_filter_test.cc b/mojo/shell/capability_filter_test.cc index c97ca70f..fcd6a97 100644 --- a/mojo/shell/capability_filter_test.cc +++ b/mojo/shell/capability_filter_test.cc
@@ -120,7 +120,7 @@ shell_ = shell; // ServiceApplications have no capability filter and can thus connect // directly to the validator application. - shell_->ConnectToService("test:validator", &validator_); + shell_->ConnectToInterface("test:validator", &validator_); } bool AcceptConnection(Connection* connection) override { AddInterface<Safe>(connection);
diff --git a/mojo/shell/public/cpp/shell.h b/mojo/shell/public/cpp/shell.h index 00e4605b..6861eab 100644 --- a/mojo/shell/public/cpp/shell.h +++ b/mojo/shell/public/cpp/shell.h
@@ -48,16 +48,17 @@ // Connect to application identified by |request->url| and connect to the // service implementation of the interface identified by |Interface|. template <typename Interface> - void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) { + void ConnectToInterface(ConnectParams* params, InterfacePtr<Interface>* ptr) { scoped_ptr<Connection> connection = Connect(params); if (connection) connection->GetInterface(ptr); } template <typename Interface> - void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) { + void ConnectToInterface(const std::string& url, + InterfacePtr<Interface>* ptr) { ConnectParams params(url); params.set_filter(CreatePermissiveCapabilityFilter()); - return ConnectToService(¶ms, ptr); + return ConnectToInterface(¶ms, ptr); } // Initiate shutdown of this application. This may involve a round trip to the
diff --git a/mojo/shell/runner/child/native_apptest.cc b/mojo/shell/runner/child/native_apptest.cc index 837f2e0c..77f69651 100644 --- a/mojo/shell/runner/child/native_apptest.cc +++ b/mojo/shell/runner/child/native_apptest.cc
@@ -20,8 +20,8 @@ TEST_F(NativeAppTest, Connect) { test::TestNativeServicePtr native_service; - shell()->ConnectToService("exe:mojo_runner_child_apptest_native_target", - &native_service); + shell()->ConnectToInterface("exe:mojo_runner_child_apptest_native_target", + &native_service); bool result = false; native_service->Invert(
diff --git a/mojo/shell/standalone/shell_apptest.cc b/mojo/shell/standalone/shell_apptest.cc index 2ded9989..7f2d2b0 100644 --- a/mojo/shell/standalone/shell_apptest.cc +++ b/mojo/shell/standalone/shell_apptest.cc
@@ -77,7 +77,7 @@ void SetUp() override { ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:http_server", &http_server_factory_); + shell()->ConnectToInterface("mojo:http_server", &http_server_factory_); NetAddressPtr local_address(NetAddress::New()); local_address->family = NET_ADDRESS_FAMILY_IPV4; @@ -117,7 +117,7 @@ // Test that we can load apps over http. TEST_F(ShellHTTPAppTest, Http) { InterfacePtr<Pingable> pingable; - shell()->ConnectToService(GetURL("app"), &pingable); + shell()->ConnectToInterface(GetURL("app"), &pingable); pingable->Ping("hello", [this](const String& app_url, const String& connection_url, const String& message) { @@ -133,7 +133,7 @@ // TODO(aa): Test that apps receive the correct URL parameters. TEST_F(ShellHTTPAppTest, Redirect) { InterfacePtr<Pingable> pingable; - shell()->ConnectToService(GetURL("redirect"), &pingable); + shell()->ConnectToInterface(GetURL("redirect"), &pingable); pingable->Ping("hello", [this](const String& app_url, const String& connection_url, const String& message) { @@ -155,8 +155,8 @@ TEST_F(ShellHTTPAppTest, MAYBE_QueryHandling) { InterfacePtr<Pingable> pingable1; InterfacePtr<Pingable> pingable2; - shell()->ConnectToService(GetURL("app?foo"), &pingable1); - shell()->ConnectToService(GetURL("app?bar"), &pingable2); + shell()->ConnectToInterface(GetURL("app?foo"), &pingable1); + shell()->ConnectToInterface(GetURL("app?bar"), &pingable2); int num_responses = 0; auto callback = [this, &num_responses](const String& app_url, @@ -182,7 +182,7 @@ // mojo: URLs can have querystrings too TEST_F(ShellAppTest, MojoURLQueryHandling) { InterfacePtr<Pingable> pingable; - shell()->ConnectToService("mojo:pingable_app?foo", &pingable); + shell()->ConnectToInterface("mojo:pingable_app?foo", &pingable); auto callback = [this](const String& app_url, const String& connection_url, const String& message) { EXPECT_TRUE(base::EndsWith(app_url, "/pingable_app.mojo",
diff --git a/native_client_sdk/src/build_tools/build_artifacts.py b/native_client_sdk/src/build_tools/build_artifacts.py index 9cde147..2a7c4b7 100755 --- a/native_client_sdk/src/build_tools/build_artifacts.py +++ b/native_client_sdk/src/build_tools/build_artifacts.py
@@ -200,8 +200,7 @@ def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): gyp_env = dict(os.environ) - gyp_env['GYP_GENERATORS'] = 'ninja' - gyp_defines = ['nacl_allow_thin_archives=0'] + gyp_defines = [] if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) if arch: @@ -210,8 +209,6 @@ gyp_env['GYP_CROSSCOMPILE'] = '1' if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') - if PLATFORM == 'mac': - gyp_defines.append('clang=1') gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) generator_flags = ['-G', 'output_dir=%s' % out_dir]
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 660c1bc..1ab95596 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -459,7 +459,7 @@ GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir) -def GypNinjaBuild_Pnacl(rel_out_dir, target_arch): +def GypNinjaBuild_Pnacl(arch, rel_out_dir): # TODO(binji): This will build the pnacl_irt_shim twice; once as part of the # Chromium build, and once here. When we move more of the SDK build process # to gyp, we can remove this. @@ -468,14 +468,12 @@ out_dir = MakeNinjaRelPath(rel_out_dir) gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') - targets = ['aot'] - GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir) + GypNinjaBuild(arch, gyp_py, gyp_file, 'aot', out_dir) def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): gyp_env = dict(os.environ) - gyp_env['GYP_GENERATORS'] = 'ninja' - gyp_defines = ['nacl_allow_thin_archives=0', 'use_nacl_clang=1'] + gyp_defines = [] if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) @@ -535,7 +533,7 @@ for arch in ('ia32', 'arm'): # Fill in the latest native pnacl shim library from the chrome build. build_dir = GYPBUILD_DIR + '-pnacl-' + arch - GypNinjaBuild_Pnacl(build_dir, arch) + GypNinjaBuild_Pnacl(arch, build_dir) GypNinjaInstall(pepperdir, toolchains)
diff --git a/native_client_sdk/src/build_tools/tests/build_artifacts_test.py b/native_client_sdk/src/build_tools/tests/build_artifacts_test.py index 3394dcb..111d48e 100755 --- a/native_client_sdk/src/build_tools/tests/build_artifacts_test.py +++ b/native_client_sdk/src/build_tools/tests/build_artifacts_test.py
@@ -106,7 +106,7 @@ self.options_mock = patch('build_artifacts.options').start() self.options_mock.mac_sdk = False self.options_mock.no_arm_trusted = False - self.gyp_defines_base = ['nacl_allow_thin_archives=0'] + self.gyp_defines_base = [] def testSimple(self): build_artifacts.GypNinjaBuild( @@ -115,8 +115,7 @@ call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 'output_dir=out_dir'], cwd='src_dir', - env={'GYP_GENERATORS': 'ninja', - 'GYP_DEFINES': ' '.join(self.gyp_defines_base)}), + env={'GYP_DEFINES': ' '.join(self.gyp_defines_base)}), call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') ]) @@ -128,7 +127,6 @@ 'output_dir=out_dir'], cwd='src_dir', env={ - 'GYP_GENERATORS': 'ninja', 'GYP_DEFINES': ' '.join(self.gyp_defines_base + ['target_arch=x64']), }), @@ -142,8 +140,7 @@ call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 'output_dir=out_dir'], cwd='src_dir', - env={'GYP_GENERATORS': 'ninja', - 'GYP_DEFINES': ' '.join(self.gyp_defines_base)}), + env={'GYP_DEFINES': ' '.join(self.gyp_defines_base)}), call(['ninja', '-C', 'out_dir/Release', 'target1', 'target2'], cwd='src_dir') ]) @@ -158,9 +155,8 @@ 'output_dir=out_dir'], cwd='src_dir', env={ - 'GYP_GENERATORS': 'ninja', 'GYP_DEFINES': ' '.join(self.gyp_defines_base + - ['mac_sdk=10.6', 'clang=1']), + ['mac_sdk=10.6']), }), call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') ]) @@ -175,7 +171,6 @@ cwd='src_dir', env={ 'GYP_CROSSCOMPILE': '1', - 'GYP_GENERATORS': 'ninja', 'GYP_DEFINES': ' '.join(self.gyp_defines_base + ['target_arch=arm']), }), @@ -193,7 +188,6 @@ cwd='src_dir', env={ 'GYP_CROSSCOMPILE': '1', - 'GYP_GENERATORS': 'ninja', 'GYP_DEFINES': ' '.join(self.gyp_defines_base + ['target_arch=arm', 'disable_cross_trusted=1']),
diff --git a/net/quic/quic_chromium_client_stream_test.cc b/net/quic/quic_chromium_client_stream_test.cc index 3edba3bb..081828b 100644 --- a/net/quic/quic_chromium_client_stream_test.cc +++ b/net/quic/quic_chromium_client_stream_test.cc
@@ -239,7 +239,8 @@ EXPECT_CALL(delegate_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicChromiumClientStreamTest::ReadData, + CreateFunctor(&QuicChromiumClientStreamTest::ReadData, + base::Unretained(this), StringPiece(data, arraysize(data) - 1)))); base::MessageLoop::current()->RunUntilIdle(); @@ -275,7 +276,8 @@ /*offset=*/0, data)); EXPECT_CALL(delegate_, OnDataAvailable()) .WillOnce(testing::Invoke(CreateFunctor( - stream_, &QuicChromiumClientStream::Reset, QUIC_STREAM_CANCELLED))); + &QuicChromiumClientStream::Reset, + base::Unretained(stream_), QUIC_STREAM_CANCELLED))); base::MessageLoop::current()->RunUntilIdle(); EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc index 07b1fc7..dc85ba10 100644 --- a/net/quic/quic_session_test.cc +++ b/net/quic/quic_session_test.cc
@@ -441,13 +441,15 @@ InSequence s; EXPECT_CALL(*stream2, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream2->id(), 6000))), Invoke(&stream2_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked))); EXPECT_CALL(*stream2, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream2->id(), 6000))), Invoke(&stream2_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked))); @@ -457,13 +459,15 @@ // write quota and we move over to stream 4. EXPECT_CALL(*stream2, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream2->id(), 6000))), Invoke(&stream2_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked))); EXPECT_CALL(*stream4, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream4->id(), 6000))), Invoke(&stream4_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked))); @@ -475,7 +479,8 @@ stream6->SetPriority(kHighestPriority); EXPECT_CALL(*stream4, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream4->id(), 6000))), Invoke(&stream4_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked), @@ -483,20 +488,23 @@ &StreamBlocker::MarkHighPriorityWriteBlocked))); EXPECT_CALL(*stream6, OnCanWrite()) .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, stream4->id(), 6000)))); + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream4->id(), 6000)))); session_.OnCanWrite(); // Stream4 alread did 6k worth of writes, so after doing another 12k it should // cede and 2 should resume. EXPECT_CALL(*stream4, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream4->id(), 12000))), Invoke(&stream4_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked))); EXPECT_CALL(*stream2, OnCanWrite()) .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendLargeFakeData, + &TestSession::SendLargeFakeData, + base::Unretained(&session_), stream2->id(), 6000))), Invoke(&stream2_blocker, &StreamBlocker::MarkConnectionLevelWriteBlocked))); @@ -526,13 +534,18 @@ .WillRepeatedly(Return(kMaxPacketSize * 10)); EXPECT_CALL(*stream2, OnCanWrite()) .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendStreamData, stream2->id())))); + &TestSession::SendStreamData, + base::Unretained(&session_), stream2->id())))); EXPECT_CALL(*stream4, OnCanWrite()) .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendStreamData, stream4->id())))); + &TestSession::SendStreamData, + base::Unretained(&session_), + stream4->id())))); EXPECT_CALL(*stream6, OnCanWrite()) .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( - &session_, &TestSession::SendStreamData, stream6->id())))); + &TestSession::SendStreamData, + base::Unretained(&session_), + stream6->id())))); // Expect that we only send one packet, the writes from different streams // should be bundled together.
diff --git a/net/quic/quic_stream_sequencer_test.cc b/net/quic/quic_stream_sequencer_test.cc index 3fb6bdac..a19d696 100644 --- a/net/quic/quic_stream_sequencer_test.cc +++ b/net/quic/quic_stream_sequencer_test.cc
@@ -182,7 +182,8 @@ TEST_P(QuicStreamSequencerTest, RejectOldFrame) { EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); OnFrame(0, "abc"); @@ -211,7 +212,8 @@ TEST_P(QuicStreamSequencerTest, FullFrameConsumed) { EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); OnFrame(0, "abc"); EXPECT_EQ(0u, NumBufferedBytes()); @@ -227,14 +229,16 @@ EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); sequencer_->SetUnblocked(); EXPECT_EQ(0u, NumBufferedBytes()); EXPECT_EQ(3u, sequencer_->NumBytesConsumed()); EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); EXPECT_FALSE(sequencer_->IsClosed()); OnFinFrame(3, "def"); EXPECT_TRUE(sequencer_->IsClosed()); @@ -249,7 +253,8 @@ EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); EXPECT_FALSE(sequencer_->IsClosed()); sequencer_->SetUnblocked(); EXPECT_TRUE(sequencer_->IsClosed()); @@ -275,7 +280,8 @@ TEST_P(QuicStreamSequencerTest, PartialFrameConsumed) { EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 2))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 2))); OnFrame(0, "abc"); EXPECT_EQ(1u, NumBufferedBytes()); @@ -312,7 +318,8 @@ EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 9))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 9))); // Now process all of them at once. OnFrame(0, "abc"); @@ -327,7 +334,8 @@ EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); OnFinFrame(0, "abc"); EXPECT_EQ(3u, QuicStreamSequencerPeer::GetCloseOffset(sequencer_.get())); @@ -340,7 +348,8 @@ OnFrame(3, "def"); EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 6))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 6))); EXPECT_FALSE(sequencer_->IsClosed()); OnFrame(0, "abc"); EXPECT_TRUE(sequencer_->IsClosed()); @@ -352,7 +361,8 @@ EXPECT_CALL(stream_, OnDataAvailable()) .WillOnce(testing::Invoke( - CreateFunctor(this, &QuicStreamSequencerTest::ConsumeData, 3))); + CreateFunctor(&QuicStreamSequencerTest::ConsumeData, + base::Unretained(this), 3))); EXPECT_FALSE(sequencer_->IsClosed()); OnFrame(0, "abc"); EXPECT_TRUE(sequencer_->IsClosed());
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp index f1cc507..83d67c6 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
@@ -27,8 +27,6 @@ 'out_newlib32_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-x86-32-nonsfi/>(nlib_target)', 'out_pnacl_newlib_arm_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-arm-nonsfi/>(nlib_target)', 'out_newlib_arm_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-arm-nonsfi/>(nlib_target)', - 'build_glibc': 0, - 'build_newlib': 0, 'build_pnacl_newlib': 1, 'pnacl_native_biased': 1, 'enable_x86_32': 1, @@ -65,18 +63,7 @@ # pnacl_support_extension rename this to the canonical name when # copying to the final target directory. 'nlib_target': 'libpnacl_irt_shim_browser.a', - 'out_pnacl_newlib_arm': '>(tc_lib_dir_pnacl_translate)/lib-arm/>(nlib_target)', - 'out_pnacl_newlib_x86_32': '>(tc_lib_dir_pnacl_translate)/lib-x86-32/>(nlib_target)', - 'out_pnacl_newlib_x86_64': '>(tc_lib_dir_pnacl_translate)/lib-x86-64/>(nlib_target)', - 'out_pnacl_newlib_mips': '>(tc_lib_dir_pnacl_translate)/lib-mips32/>(nlib_target)', - 'build_glibc': 0, - 'build_newlib': 0, - 'build_pnacl_newlib': 1, - 'pnacl_native_biased': 1, - 'enable_x86_32': 1, - 'enable_x86_64': 1, - 'enable_arm': 1, - 'enable_mips': 1, + 'build_newlib': 1, 'sources': [ 'shim_entry.c', 'shim_ppapi.c',
diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp index 3230ae2..7d704ee94 100644 --- a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp +++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
@@ -62,14 +62,14 @@ '<(pnacl_output_prefix)x86_64_pnacl_llc_nexe', ], 'inputs': [ - '>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim_browser.a', - '>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim_browser.a', + '>(tc_lib_dir_newlib32)/libpnacl_irt_shim_browser.a', + '>(tc_lib_dir_newlib64)/libpnacl_irt_shim_browser.a', ], 'variables': { 'lib_overrides': [ # Use the two freshly generated shims. - '--lib_override=ia32,>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', - '--lib_override=x64,>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', + '--lib_override=ia32,>(tc_lib_dir_newlib32)/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', + '--lib_override=x64,>(tc_lib_dir_newlib64)/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', ], }, }], @@ -86,12 +86,12 @@ '<(pnacl_output_prefix)arm_pnacl_llc_nexe', ], 'inputs': [ - '>(tc_lib_dir_pnacl_translate)/lib-arm/libpnacl_irt_shim_browser.a', + '>(tc_lib_dir_newlib_arm)/libpnacl_irt_shim_browser.a', ], 'variables': { 'lib_overrides': [ # Use the freshly generated shim. - '--lib_override=arm,>(tc_lib_dir_pnacl_translate)/lib-arm/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', + '--lib_override=arm,>(tc_lib_dir_newlib_arm)/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', ], }, }], @@ -105,12 +105,12 @@ '<(pnacl_output_prefix)mips32_pnacl_llc_nexe', ], 'inputs': [ - '>(tc_lib_dir_pnacl_translate)/lib-mips32/libpnacl_irt_shim_browser.a', + '>(tc_lib_dir_newlib_mips)/libpnacl_irt_shim_browser.a', ], 'variables': { 'lib_overrides': [ # Use the freshly generated shim. - '--lib_override=mipsel,>(tc_lib_dir_pnacl_translate)/lib-mips32/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', + '--lib_override=mipsel,>(tc_lib_dir_newlib_mips)/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', ], }, }], @@ -124,12 +124,12 @@ '<(pnacl_output_prefix)x86_32_pnacl_llc_nexe', ], 'inputs': [ - '>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim_browser.a', + '>(tc_lib_dir_newlib32)/libpnacl_irt_shim_browser.a', ], 'variables': { 'lib_overrides': [ # Use the freshly generated shim. - '--lib_override=ia32,>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', + '--lib_override=ia32,>(tc_lib_dir_newlib32)/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', ], }, }], @@ -143,12 +143,12 @@ '<(pnacl_output_prefix)x86_64_pnacl_llc_nexe', ], 'inputs': [ - '>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim_browser.a', + '>(tc_lib_dir_newlib64)/libpnacl_irt_shim_browser.a', ], 'variables': { 'lib_overrides': [ # Use the freshly generated shim. - '--lib_override=x64,>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', + '--lib_override=x64,>(tc_lib_dir_newlib64)/libpnacl_irt_shim_browser.a,libpnacl_irt_shim.a', ], }, }],
diff --git a/remoting/android/java/src/org/chromium/chromoting/CapabilityManager.java b/remoting/android/java/src/org/chromium/chromoting/CapabilityManager.java index 0a551bf4e..e332e839 100644 --- a/remoting/android/java/src/org/chromium/chromoting/CapabilityManager.java +++ b/remoting/android/java/src/org/chromium/chromoting/CapabilityManager.java
@@ -21,6 +21,10 @@ * The CapabilityManager mirrors how the Chromoting host handles extension messages. For each * incoming extension message, runs through a list of HostExtensionSession objects, giving each one * a chance to handle the message. + * + * The CapabilityManager is a singleton class so we can manage client extensions on an application + * level. The singleton object may be used from multiple Activities, thus allowing it to support + * different capabilities at different stages of the application. */ public class CapabilityManager { /** Used to allow objects to receive notifications when the host capabilites are received. */ @@ -46,6 +50,12 @@ private static final String TAG = "Chromoting"; + /** Lazily-initialized singleton object that can be used from different Activities. */ + private static CapabilityManager sInstance; + + /** Protects access to |sInstance|. */ + private static final Object sInstanceLock = new Object(); + /** List of all capabilities that are supported by the application. */ private List<String> mLocalCapabilities; @@ -58,7 +68,7 @@ /** Maintains a list of listeners to notify when host capabilities are received. */ private List<CapabilitiesChangedListener> mCapabilitiesChangedListeners; - public CapabilityManager() { + private CapabilityManager() { mLocalCapabilities = new ArrayList<String>(); mClientExtensions = new ArrayList<ClientExtension>(); @@ -69,6 +79,18 @@ } /** + * Returns the singleton object. Thread-safe. + */ + public static CapabilityManager getInstance() { + synchronized (sInstanceLock) { + if (sInstance == null) { + sInstance = new CapabilityManager(); + } + return sInstance; + } + } + + /** * Cleans up host specific state when the connection has been terminated. */ public void onHostDisconnect() {
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java index f53926c..a10a17f4 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
@@ -36,7 +36,6 @@ import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory; import org.chromium.chromoting.help.HelpContext; import org.chromium.chromoting.help.HelpSingleton; -import org.chromium.chromoting.jni.Client; import org.chromium.chromoting.jni.ConnectionListener; import org.chromium.chromoting.jni.JniInterface; @@ -118,9 +117,6 @@ private AccountSwitcher mAccountSwitcher; - /** The currently-connected Client, if any. */ - private Client mClient; - /** Shows a warning explaining that a Google account is required, then closes the activity. */ private void showNoAccountsDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); @@ -353,14 +349,8 @@ @Override public void onDestroy() { super.onDestroy(); + JniInterface.disconnectFromHost(); mAccountSwitcher.destroy(); - - // TODO(lambroslambrou): Determine whether we really need to tear down the connection here, - // so we can remove this code. - if (mClient != null) { - mClient.destroy(); - mClient = null; - } } /** Called when a child Activity exits and sends a result back to this Activity. */ @@ -454,11 +444,6 @@ } private void connectToHost(HostInfo host) { - if (mClient != null) { - mClient.destroy(); - } - - mClient = new Client(); mProgressIndicator = ProgressDialog.show( this, host.name, @@ -468,15 +453,11 @@ new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { - if (mClient != null) { - mClient.destroy(); - mClient = null; - } + JniInterface.disconnectFromHost(); } }); - - SessionConnector connector = new SessionConnector(mClient, this, this, mHostListLoader); - mAuthenticator = new SessionAuthenticator(this, mClient, host); + SessionConnector connector = new SessionConnector(this, this, mHostListLoader); + mAuthenticator = new SessionAuthenticator(this, host); connector.connectToHost(mAccount, mToken, host, mAuthenticator, getPreferences(MODE_PRIVATE).getString(PREFERENCE_EXPERIMENTAL_FLAGS, "")); }
diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java index f9f3c73a..93e54b1 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
@@ -31,7 +31,7 @@ import org.chromium.chromoting.cardboard.DesktopActivity; import org.chromium.chromoting.help.HelpContext; import org.chromium.chromoting.help.HelpSingleton; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; import java.util.List; import java.util.Set; @@ -69,8 +69,6 @@ /** The surface that displays the remote host's desktop feed. */ private DesktopView mRemoteHostDesktop; - private Client mClient; - /** Set of pressed keys for which we've sent TextEvent. */ private Set<Integer> mPressedTextKeys = new TreeSet<Integer>(); @@ -104,14 +102,11 @@ super.onCreate(savedInstanceState); setContentView(R.layout.desktop); - mClient = Client.getInstance(); - mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); mRemoteHostDesktop = (DesktopView) findViewById(R.id.desktop_view); mRemoteHostDesktop.setDesktop(this); - mRemoteHostDesktop.setClient(mClient); mSwitchToCardboardDesktopActivity = false; getSupportActionBar().setDisplayShowTitleEnabled(false); @@ -129,7 +124,7 @@ View decorView = getWindow().getDecorView(); decorView.setOnSystemUiVisibilityChangeListener(this); - mActivityLifecycleListener = mClient.getCapabilityManager().onActivityAcceptingListener( + mActivityLifecycleListener = CapabilityManager.getInstance().onActivityAcceptingListener( this, Capabilities.CAST_CAPABILITY); mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); @@ -168,9 +163,9 @@ protected void onStart() { super.onStart(); mActivityLifecycleListener.onActivityStarted(this); - mClient.enableVideoChannel(true); + JniInterface.enableVideoChannel(true); mRemoteHostDesktop.attachRedrawCallback(); - mClient.getCapabilityManager().addListener(this); + CapabilityManager.getInstance().addListener(this); } @Override @@ -178,7 +173,7 @@ if (isFinishing()) mActivityLifecycleListener.onActivityPaused(this); super.onPause(); if (!mSwitchToCardboardDesktopActivity) { - mClient.enableVideoChannel(false); + JniInterface.enableVideoChannel(false); } stopActionBarAutoHideTimer(); } @@ -187,19 +182,19 @@ public void onResume() { super.onResume(); mActivityLifecycleListener.onActivityResumed(this); - mClient.enableVideoChannel(true); + JniInterface.enableVideoChannel(true); startActionBarAutoHideTimer(); } @Override protected void onStop() { - mClient.getCapabilityManager().removeListener(this); + CapabilityManager.getInstance().removeListener(this); mActivityLifecycleListener.onActivityStopped(this); super.onStop(); if (mSwitchToCardboardDesktopActivity) { mSwitchToCardboardDesktopActivity = false; } else { - mClient.enableVideoChannel(false); + JniInterface.enableVideoChannel(false); } } @@ -494,7 +489,7 @@ return true; } if (id == R.id.actionbar_disconnect || id == android.R.id.home) { - mClient.destroy(); + JniInterface.disconnectFromHost(); return true; } if (id == R.id.actionbar_send_ctrl_alt_del) { @@ -504,10 +499,10 @@ KeyEvent.KEYCODE_FORWARD_DEL, }; for (int key : keys) { - mClient.sendKeyEvent(0, key, true); + JniInterface.sendKeyEvent(0, key, true); } for (int key : keys) { - mClient.sendKeyEvent(0, key, false); + JniInterface.sendKeyEvent(0, key, false); } return true; } @@ -614,7 +609,7 @@ // Dispatch the back button to the system to handle navigation if (keyCode == KeyEvent.KEYCODE_BACK) { - mClient.destroy(); + JniInterface.disconnectFromHost(); return super.dispatchKeyEvent(event); } @@ -626,7 +621,7 @@ // the keyboard layout selected on the client doesn't affect the key // codes sent to the host. if (event.getDeviceId() != KeyCharacterMap.VIRTUAL_KEYBOARD) { - return mClient.sendKeyEvent(event.getScanCode(), 0, pressed); + return JniInterface.sendKeyEvent(event.getScanCode(), 0, pressed); } // Events received from software keyboards generate TextEvent in two @@ -637,7 +632,7 @@ // correspond to what user sees on the screen, while physical keyboard // acts as if it is connected to the remote host. if (event.getAction() == KeyEvent.ACTION_MULTIPLE) { - mClient.sendTextEvent(event.getCharacters()); + JniInterface.sendTextEvent(event.getCharacters()); return true; } @@ -651,7 +646,7 @@ if (pressed && unicode != 0 && no_modifiers) { mPressedTextKeys.add(keyCode); int[] codePoints = { unicode }; - mClient.sendTextEvent(new String(codePoints, 0, 1)); + JniInterface.sendTextEvent(new String(codePoints, 0, 1)); return true; } @@ -666,28 +661,28 @@ // third-party keyboards that may still generate these events. See // https://source.android.com/devices/input/keyboard-devices.html#legacy-unsupported-keys case KeyEvent.KEYCODE_AT: - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_2, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_2, pressed); return true; case KeyEvent.KEYCODE_POUND: - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_3, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_3, pressed); return true; case KeyEvent.KEYCODE_STAR: - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_8, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_8, pressed); return true; case KeyEvent.KEYCODE_PLUS: - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); - mClient.sendKeyEvent(0, KeyEvent.KEYCODE_EQUALS, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); + JniInterface.sendKeyEvent(0, KeyEvent.KEYCODE_EQUALS, pressed); return true; default: // We try to send all other key codes to the host directly. - return mClient.sendKeyEvent(0, keyCode, pressed); + return JniInterface.sendKeyEvent(0, keyCode, pressed); } } }
diff --git a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java index e79065d3..0c2330b 100644 --- a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java +++ b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
@@ -25,7 +25,7 @@ import android.view.inputmethod.InputMethodManager; import org.chromium.base.Log; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; /** * The user interface for viewing and interacting with a specific remote host. @@ -46,10 +46,6 @@ /** The parent Desktop activity. */ private Desktop mDesktop; - /** The Client connection, used to inject input and fetch the video frames. */ - private Client mClient; - - // Flag to prevent multiple repaint requests from being backed up. Requests for repainting will // be dropped if this is already set to true. This is used by the main thread and the painting // thread, so the access should be synchronized on |mRenderData|. @@ -183,10 +179,6 @@ mDesktop = desktop; } - public void setClient(Client client) { - mClient = client; - } - /** See {@link TouchInputHandler#onSoftInputMethodVisibilityChanged} for API details. */ public void onSoftInputMethodVisibilityChanged(boolean inputMethodVisible, Rect bounds) { mInputHandler.onSoftInputMethodVisibilityChanged(inputMethodVisible, bounds); @@ -200,7 +192,7 @@ } mRepaintPending = true; } - mClient.redrawGraphics(); + JniInterface.redrawGraphics(); } /** @@ -215,7 +207,7 @@ Log.w(TAG, "Canvas being redrawn on UI thread"); } - Bitmap image = mClient.getVideoFrame(); + Bitmap image = JniInterface.getVideoFrame(); if (image == null) { // This can happen if the client is connected, but a complete video frame has not yet // been decoded. @@ -228,7 +220,7 @@ synchronized (mRenderData) { if (mRenderData.imageWidth != width || mRenderData.imageHeight != height) { // TODO(lambroslambrou): Move this code into a sizeChanged() callback, to be - // triggered from native code (on the display thread) when the remote screen size + // triggered from JniInterface (on the display thread) when the remote screen size // changes. mRenderData.imageWidth = width; mRenderData.imageHeight = height; @@ -274,9 +266,9 @@ } if (drawCursor) { - Bitmap cursorBitmap = mClient.getCursorBitmap(); + Bitmap cursorBitmap = JniInterface.getCursorBitmap(); if (cursorBitmap != null) { - Point hotspot = mClient.getCursorHotspot(); + Point hotspot = JniInterface.getCursorHotspot(); canvas.drawBitmap(cursorBitmap, cursorPosition.x - hotspot.x, cursorPosition.y - hotspot.y, new Paint()); } @@ -327,7 +319,7 @@ } public void attachRedrawCallback() { - mClient.provideRedrawCallback(new Runnable() { + JniInterface.provideRedrawCallback(new Runnable() { @Override public void run() { paint(); @@ -423,15 +415,15 @@ switch (inputMode) { case TRACKPAD: - mInputHandler.setInputStrategy(new TrackpadInputStrategy(mRenderData, mClient)); + mInputHandler.setInputStrategy(new TrackpadInputStrategy(mRenderData)); break; case TOUCH: if (hostTouchCapability.isSupported()) { - mInputHandler.setInputStrategy(new TouchInputStrategy(mRenderData, mClient)); + mInputHandler.setInputStrategy(new TouchInputStrategy(mRenderData)); } else { mInputHandler.setInputStrategy( - new SimulatedTouchInputStrategy(mRenderData, mClient, getContext())); + new SimulatedTouchInputStrategy(mRenderData, getContext())); } break;
diff --git a/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java b/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java index ce50a04..a18c2f4 100644 --- a/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java +++ b/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java
@@ -16,7 +16,7 @@ import android.widget.TextView; import android.widget.Toast; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; /** * This class performs the user-interaction needed to authenticate the session connection. This @@ -29,18 +29,14 @@ */ private Chromoting mApplicationContext; - /** Client connection being authenticated. */ - private final Client mClient; - /** Provides the tokenUrlPatterns for this host during fetchThirdPartyTokens(). */ private HostInfo mHost; /** Object for fetching OAuth2 access tokens from third party authorization servers. */ private ThirdPartyTokenFetcher mTokenFetcher; - public SessionAuthenticator(Chromoting context, Client client, HostInfo host) { + public SessionAuthenticator(Chromoting context, HostInfo host) { mApplicationContext = context; - mClient = client; mHost = host; } @@ -66,8 +62,8 @@ R.string.connect_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - if (mClient.isConnected()) { - mClient.handleAuthenticationResponse( + if (JniInterface.isConnected()) { + JniInterface.handleAuthenticationResponse( String.valueOf(pinTextView.getText()), pinCheckBox.isChecked(), Build.MODEL); } else { @@ -82,7 +78,7 @@ R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - mClient.destroy(); + JniInterface.disconnectFromHost(); } }); @@ -142,7 +138,7 @@ // authenticate itself with the host using spake. String sharedSecret = accessToken; - mClient.onThirdPartyTokenFetched(token, sharedSecret); + JniInterface.onThirdPartyTokenFetched(token, sharedSecret); } }; mTokenFetcher = new ThirdPartyTokenFetcher(mApplicationContext, mHost.getTokenUrlPatterns(),
diff --git a/remoting/android/java/src/org/chromium/chromoting/SessionConnector.java b/remoting/android/java/src/org/chromium/chromoting/SessionConnector.java index 38e4634..4fa9522 100644 --- a/remoting/android/java/src/org/chromium/chromoting/SessionConnector.java +++ b/remoting/android/java/src/org/chromium/chromoting/SessionConnector.java
@@ -4,15 +4,15 @@ package org.chromium.chromoting; -import org.chromium.chromoting.jni.Client; import org.chromium.chromoting.jni.ConnectionListener; +import org.chromium.chromoting.jni.JniInterface; /** * This class manages making a connection to a host, with logic for reloading the host list and * retrying the connection in the case of a stale host JID. */ -public class SessionConnector implements ConnectionListener, HostListLoader.Callback { - private Client mClient; +public class SessionConnector implements ConnectionListener, + HostListLoader.Callback { private ConnectionListener mConnectionListener; private HostListLoader.Callback mHostListCallback; private HostListLoader mHostListLoader; @@ -38,9 +38,8 @@ * @param hostListCallback Object to be notified whenever the host list is reloaded. * @param hostListLoader The object used for reloading the host list. */ - public SessionConnector(Client client, ConnectionListener connectionListener, + public SessionConnector(ConnectionListener connectionListener, HostListLoader.Callback hostListCallback, HostListLoader hostListLoader) { - mClient = client; mConnectionListener = connectionListener; mHostListCallback = hostListCallback; mHostListLoader = hostListLoader; @@ -66,7 +65,7 @@ } private void doConnect() { - mClient.connectToHost(mAccountName, mAuthToken, mHost.jabberId, mHost.id, + JniInterface.connectToHost(mAccountName, mAuthToken, mHost.jabberId, mHost.id, mHost.publicKey, mAuthenticator, mFlags, this); }
diff --git a/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java b/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java index ccc0dbd..2c3ded29 100644 --- a/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java +++ b/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java
@@ -10,7 +10,7 @@ import android.view.MotionEvent; import android.view.ViewConfiguration; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; /** * This class receives local touch events and translates them into the appropriate mouse based @@ -22,7 +22,6 @@ private static final float DOUBLE_TAP_SLOP_SCALE_FACTOR = 0.25f; private final RenderData mRenderData; - private final Client mClient; /** * Stores the time of the most recent left button single tap processed. @@ -49,9 +48,8 @@ /** Mouse-button currently held down, or BUTTON_UNDEFINED otherwise. */ private int mHeldButton = TouchInputHandlerInterface.BUTTON_UNDEFINED; - public SimulatedTouchInputStrategy(RenderData renderData, Client client, Context context) { + public SimulatedTouchInputStrategy(RenderData renderData, Context context) { mRenderData = renderData; - mClient = client; ViewConfiguration config = ViewConfiguration.get(context); mDoubleTapDurationInMs = config.getDoubleTapTimeout(); @@ -123,7 +121,7 @@ @Override public void onScroll(float distanceX, float distanceY) { - mClient.sendMouseWheelEvent((int) -distanceX, (int) -distanceY); + JniInterface.sendMouseWheelEvent((int) -distanceX, (int) -distanceY); } @Override @@ -137,7 +135,7 @@ @Override public void injectCursorMoveEvent(int x, int y) { - mClient.sendMouseEvent(x, y, TouchInputHandlerInterface.BUTTON_UNDEFINED, false); + JniInterface.sendMouseEvent(x, y, TouchInputHandlerInterface.BUTTON_UNDEFINED, false); } @Override @@ -182,6 +180,6 @@ } private void injectMouseButtonEvent(int button, boolean pressed, Point tapPoint) { - mClient.sendMouseEvent(tapPoint.x, tapPoint.y, button, pressed); + JniInterface.sendMouseEvent(tapPoint.x, tapPoint.y, button, pressed); } }
diff --git a/remoting/android/java/src/org/chromium/chromoting/TouchInputStrategy.java b/remoting/android/java/src/org/chromium/chromoting/TouchInputStrategy.java index 19d70e31..488760b 100644 --- a/remoting/android/java/src/org/chromium/chromoting/TouchInputStrategy.java +++ b/remoting/android/java/src/org/chromium/chromoting/TouchInputStrategy.java
@@ -8,7 +8,7 @@ import android.view.MotionEvent; import org.chromium.base.VisibleForTesting; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; import org.chromium.chromoting.jni.TouchEventData; import java.util.ArrayList; @@ -37,15 +37,15 @@ /** * This class provides the default implementation for injecting remote events. */ - private class DefaultInputInjector implements RemoteInputInjector { + private static class DefaultInputInjector implements RemoteInputInjector { @Override public void injectMouseEvent(int x, int y, int button, boolean buttonDown) { - mClient.sendMouseEvent(x, y, button, buttonDown); + JniInterface.sendMouseEvent(x, y, button, buttonDown); } @Override public void injectTouchEvent(TouchEventData.EventType eventType, TouchEventData[] data) { - mClient.sendTouchEvent(eventType, data); + JniInterface.sendTouchEvent(eventType, data); } } @@ -77,13 +77,10 @@ private final RenderData mRenderData; - private final Client mClient; - private RemoteInputInjector mRemoteInputInjector; - public TouchInputStrategy(RenderData renderData, Client client) { + public TouchInputStrategy(RenderData renderData) { mRenderData = renderData; - mClient = client; mRemoteInputInjector = new DefaultInputInjector(); mQueuedEvents = new LinkedList<MotionEvent>();
diff --git a/remoting/android/java/src/org/chromium/chromoting/TrackpadInputStrategy.java b/remoting/android/java/src/org/chromium/chromoting/TrackpadInputStrategy.java index c9dcf4b..326eff97 100644 --- a/remoting/android/java/src/org/chromium/chromoting/TrackpadInputStrategy.java +++ b/remoting/android/java/src/org/chromium/chromoting/TrackpadInputStrategy.java
@@ -7,7 +7,7 @@ import android.graphics.Point; import android.view.MotionEvent; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; /** * Defines a set of behavior and methods to simulate trackpad behavior when responding to @@ -16,14 +16,12 @@ */ public class TrackpadInputStrategy implements InputStrategyInterface { private final RenderData mRenderData; - private final Client mClient; /** Mouse-button currently held down, or BUTTON_UNDEFINED otherwise. */ private int mHeldButton = TouchInputHandlerInterface.BUTTON_UNDEFINED; - public TrackpadInputStrategy(RenderData renderData, Client client) { + public TrackpadInputStrategy(RenderData renderData) { mRenderData = renderData; - mClient = client; synchronized (mRenderData) { mRenderData.drawCursor = true; @@ -46,7 +44,7 @@ @Override public void onScroll(float distanceX, float distanceY) { - mClient.sendMouseWheelEvent((int) -distanceX, (int) -distanceY); + JniInterface.sendMouseWheelEvent((int) -distanceX, (int) -distanceY); } @Override @@ -60,7 +58,7 @@ @Override public void injectCursorMoveEvent(int x, int y) { - mClient.sendMouseEvent(x, y, TouchInputHandlerInterface.BUTTON_UNDEFINED, false); + JniInterface.sendMouseEvent(x, y, TouchInputHandlerInterface.BUTTON_UNDEFINED, false); } @Override @@ -83,6 +81,6 @@ synchronized (mRenderData) { cursorPosition = mRenderData.getCursorPosition(); } - mClient.sendMouseEvent(cursorPosition.x, cursorPosition.y, button, pressed); + JniInterface.sendMouseEvent(cursorPosition.x, cursorPosition.y, button, pressed); } }
diff --git a/remoting/android/java/src/org/chromium/chromoting/cardboard/CardboardRenderer.java b/remoting/android/java/src/org/chromium/chromoting/cardboard/CardboardRenderer.java index e8a05f0..843edd1 100644 --- a/remoting/android/java/src/org/chromium/chromoting/cardboard/CardboardRenderer.java +++ b/remoting/android/java/src/org/chromium/chromoting/cardboard/CardboardRenderer.java
@@ -15,7 +15,7 @@ import com.google.vrtoolkit.cardboard.HeadTransform; import com.google.vrtoolkit.cardboard.Viewport; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; import javax.microedition.khronos.egl.EGLConfig; @@ -65,7 +65,6 @@ private static final float EPSILON = 1e-5f; private final Activity mActivity; - private final Client mClient; private float mCameraPosition; @@ -104,9 +103,8 @@ // Flag to indicate whether to show menu bar. private boolean mMenuBarVisible; - public CardboardRenderer(Activity activity, Client client) { + public CardboardRenderer(Activity activity) { mActivity = activity; - mClient = client; mCameraPosition = 0.0f; mCameraMatrix = new float[16]; @@ -124,7 +122,7 @@ private void initializeRedrawCallback() { mActivity.runOnUiThread(new Runnable() { public void run() { - mClient.provideRedrawCallback(new Runnable() { + JniInterface.provideRedrawCallback(new Runnable() { @Override public void run() { mDesktop.reloadTexture(); @@ -132,7 +130,7 @@ } }); - mClient.redrawGraphics(); + JniInterface.redrawGraphics(); } }); } @@ -148,10 +146,10 @@ // Enable depth testing. GLES20.glEnable(GLES20.GL_DEPTH_TEST); - mDesktop = new Desktop(mClient); + mDesktop = new Desktop(); mMenuBar = new MenuBar(mActivity); mPhotosphere = new Photosphere(mActivity); - mCursor = new Cursor(mClient); + mCursor = new Cursor(); initializeRedrawCallback(); } @@ -431,4 +429,4 @@ return Math.abs(phi) > FARAWAY_ANGLE_RATIO * Math.abs(theta); } -} +} \ No newline at end of file
diff --git a/remoting/android/java/src/org/chromium/chromoting/cardboard/Cursor.java b/remoting/android/java/src/org/chromium/chromoting/cardboard/Cursor.java index 534728a8..34403d6 100644 --- a/remoting/android/java/src/org/chromium/chromoting/cardboard/Cursor.java +++ b/remoting/android/java/src/org/chromium/chromoting/cardboard/Cursor.java
@@ -13,7 +13,7 @@ import android.opengl.GLES20; import org.chromium.chromoting.TouchInputHandler; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; import java.nio.FloatBuffer; @@ -52,8 +52,6 @@ // Threshold to determine whether to send the mouse move event. private static final float CURSOR_MOVE_THRESHOLD = 1.0f; - private final Client mClient; - private FloatBuffer mPositionCoordinates; private int mVertexShaderHandle; @@ -78,8 +76,7 @@ private PointF mCursorPosition; - public Cursor(Client client) { - mClient = client; + public Cursor() { mHalfFrameSize = new PointF(0.0f, 0.0f); mCursorPosition = new PointF(0.0f, 0.0f); @@ -123,7 +120,7 @@ */ public void moveTo(PointF position) { if (moveCursor(position)) { - mClient.sendMouseEvent((int) position.x, (int) position.y, + JniInterface.sendMouseEvent((int) position.x, (int) position.y, TouchInputHandler.BUTTON_UNDEFINED, false); } mCursorPosition = position; @@ -140,7 +137,7 @@ } } - Bitmap cursorBitmap = mClient.getCursorBitmap(); + Bitmap cursorBitmap = JniInterface.getCursorBitmap(); if (cursorBitmap == mCursorBitmap) { // Case when cursor image has not changed. @@ -151,7 +148,7 @@ } mCursorBitmap = cursorBitmap; - updatePosition(desktop, mCursorBitmap, mClient.getCursorHotspot()); + updatePosition(desktop, mCursorBitmap, JniInterface.getCursorHotspot()); TextureHelper.linkTexture(mTextureDataHandle, cursorBitmap);
diff --git a/remoting/android/java/src/org/chromium/chromoting/cardboard/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/cardboard/Desktop.java index d987f6b..ded464b 100644 --- a/remoting/android/java/src/org/chromium/chromoting/cardboard/Desktop.java +++ b/remoting/android/java/src/org/chromium/chromoting/cardboard/Desktop.java
@@ -11,7 +11,7 @@ import android.graphics.Point; import android.opengl.GLES20; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; import java.nio.FloatBuffer; @@ -61,8 +61,6 @@ // Number of vertices passed to glDrawArrays(). private static final int VERTICES_NUMBER = 6; - private final Client mClient; - private int mVertexShaderHandle; private int mFragmentShaderHandle; private int mProgramHandle; @@ -89,8 +87,7 @@ // Lock to allow multithreaded access to mReloadTexture. private final Object mReloadTextureLock = new Object(); - public Desktop(Client client) { - mClient = client; + public Desktop() { mVertexShaderHandle = ShaderHelper.compileShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADER); mFragmentShaderHandle = @@ -223,7 +220,7 @@ } // TODO(shichengfeng): Record the time desktop drawing takes. - Bitmap bitmap = mClient.getVideoFrame(); + Bitmap bitmap = JniInterface.getVideoFrame(); if (bitmap == null) { // This can happen if the client is connected, but a complete video frame has not yet @@ -247,4 +244,4 @@ mReloadTexture = true; } } -} +} \ No newline at end of file
diff --git a/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java b/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java index 7800b4ef..1f37082f 100644 --- a/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java +++ b/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java
@@ -16,7 +16,7 @@ import org.chromium.chromoting.R; import org.chromium.chromoting.TouchInputHandler; -import org.chromium.chromoting.jni.Client; +import org.chromium.chromoting.jni.JniInterface; import java.util.ArrayList; @@ -28,7 +28,6 @@ // desktop activity. private boolean mSwitchToDesktopActivity; - private Client mClient; private CardboardRenderer mRenderer; private SpeechRecognizer mSpeechRecognizer; @@ -39,12 +38,9 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cardboard_desktop); - - mClient = Client.getInstance(); - mSwitchToDesktopActivity = false; CardboardView cardboardView = (CardboardView) findViewById(R.id.cardboard_view); - mRenderer = new CardboardRenderer(this, mClient); + mRenderer = new CardboardRenderer(this); mIsListening = false; // Associate a CardboardView.StereoRenderer with cardboard view. @@ -79,9 +75,9 @@ } else { if (mRenderer.isLookingAtDesktop()) { PointF coordinates = mRenderer.getMouseCoordinates(); - mClient.sendMouseEvent((int) coordinates.x, (int) coordinates.y, + JniInterface.sendMouseEvent((int) coordinates.x, (int) coordinates.y, TouchInputHandler.BUTTON_LEFT, true); - mClient.sendMouseEvent((int) coordinates.x, (int) coordinates.y, + JniInterface.sendMouseEvent((int) coordinates.x, (int) coordinates.y, TouchInputHandler.BUTTON_LEFT, false); } else { if (mRenderer.isLookingFarawayFromDesktop()) { @@ -96,14 +92,14 @@ @Override protected void onStart() { super.onStart(); - mClient.enableVideoChannel(true); + JniInterface.enableVideoChannel(true); } @Override protected void onPause() { super.onPause(); if (!mSwitchToDesktopActivity) { - mClient.enableVideoChannel(false); + JniInterface.enableVideoChannel(false); } if (mSpeechRecognizer != null) { mSpeechRecognizer.stopListening(); @@ -113,7 +109,7 @@ @Override protected void onResume() { super.onResume(); - mClient.enableVideoChannel(true); + JniInterface.enableVideoChannel(true); } @Override @@ -122,7 +118,7 @@ if (mSwitchToDesktopActivity) { mSwitchToDesktopActivity = false; } else { - mClient.enableVideoChannel(false); + JniInterface.enableVideoChannel(false); } if (mSpeechRecognizer != null) { mSpeechRecognizer.stopListening(); @@ -190,7 +186,7 @@ ArrayList<String> data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION); if (!data.isEmpty()) { - mClient.sendTextEvent(data.get(0)); + JniInterface.sendTextEvent(data.get(0)); } }
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/Client.java b/remoting/android/java/src/org/chromium/chromoting/jni/Client.java index bcbe82a8..6c67a8c 100644 --- a/remoting/android/java/src/org/chromium/chromoting/jni/Client.java +++ b/remoting/android/java/src/org/chromium/chromoting/jni/Client.java
@@ -4,17 +4,7 @@ package org.chromium.chromoting.jni; -import android.graphics.Bitmap; -import android.graphics.Point; -import android.os.Looper; - -import org.chromium.base.Log; import org.chromium.base.annotations.JNINamespace; -import org.chromium.chromoting.CapabilityManager; -import org.chromium.chromoting.SessionAuthenticator; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; /** * Class to manage a client connection to the host. This class controls the lifetime of the @@ -24,377 +14,18 @@ */ @JNINamespace("remoting") public class Client { - private static final String TAG = "Chromoting"; - // Pointer to the C++ object, cast to a |long|. private long mNativeJniClient; - // The global Client instance (may be null). This needs to be a global singleton so that the - // Client can be passed between Activities. - private static Client sClient; - - // Called on the UI thread. - public Client() { - if (sClient != null) { - throw new RuntimeException("Client instance already created."); - } - - sClient = this; + public void init() { mNativeJniClient = nativeInit(); } private native long nativeInit(); - // Called on the UI thread. public void destroy() { - if (sClient != null) { - disconnectFromHost(); - nativeDestroy(mNativeJniClient); - sClient = null; - } + nativeDestroy(mNativeJniClient); } private native void nativeDestroy(long nativeJniClient); - - /** Returns the current Client instance, or null. */ - public static Client getInstance() { - return sClient; - } - - /** Used for authentication-related UX during connection. Accessed on the UI thread. */ - private SessionAuthenticator mAuthenticator; - - /** Whether the native code is attempting a connection. Accessed on the UI thread. */ - private boolean mConnected; - - /** Notified upon successful connection or disconnection. Accessed on the UI thread. */ - private ConnectionListener mConnectionListener; - - /** - * Callback invoked on the graphics thread to repaint the desktop. Accessed on the UI and - * graphics threads. - */ - private Runnable mRedrawCallback; - - /** Bitmap holding a copy of the latest video frame. Accessed on the UI and graphics threads. */ - private Bitmap mFrameBitmap; - - /** Protects access to {@link mFrameBitmap}. */ - private final Object mFrameLock = new Object(); - - /** Position of cursor hot-spot. Accessed on the graphics thread. */ - private Point mCursorHotspot = new Point(); - - /** Bitmap holding the cursor shape. Accessed on the graphics thread. */ - private Bitmap mCursorBitmap; - - /** Capability Manager through which capabilities and extensions are handled. */ - private CapabilityManager mCapabilityManager = new CapabilityManager(); - - public CapabilityManager getCapabilityManager() { - return mCapabilityManager; - } - - /** Returns whether the client is connected. */ - public boolean isConnected() { - return mConnected; - } - - /** Attempts to form a connection to the user-selected host. Called on the UI thread. */ - public void connectToHost(String username, String authToken, String hostJid, - String hostId, String hostPubkey, SessionAuthenticator authenticator, String flags, - ConnectionListener listener) { - disconnectFromHost(); - - mConnectionListener = listener; - mAuthenticator = authenticator; - JniInterface.nativeConnect(username, authToken, hostJid, hostId, hostPubkey, - mAuthenticator.getPairingId(hostId), mAuthenticator.getPairingSecret(hostId), - mCapabilityManager.getLocalCapabilities(), flags); - mConnected = true; - } - - /** Severs the connection and cleans up. Called on the UI thread. */ - public void disconnectFromHost() { - if (!mConnected) { - return; - } - - mConnectionListener.onConnectionState( - ConnectionListener.State.CLOSED, ConnectionListener.Error.OK); - - disconnectFromHostWithoutNotification(); - } - - /** Same as disconnectFromHost() but without notifying the ConnectionListener. */ - private void disconnectFromHostWithoutNotification() { - if (!mConnected) { - return; - } - - JniInterface.nativeDisconnect(); - mConnectionListener = null; - mConnected = false; - mCapabilityManager.onHostDisconnect(); - - // Drop the reference to free the Bitmap for GC. - synchronized (mFrameLock) { - mFrameBitmap = null; - } - } - - /** Called by native code whenever the connection status changes. Called on the UI thread. */ - void onConnectionState(int stateCode, int errorCode) { - ConnectionListener.State state = ConnectionListener.State.fromValue(stateCode); - ConnectionListener.Error error = ConnectionListener.Error.fromValue(errorCode); - mConnectionListener.onConnectionState(state, error); - if (state == ConnectionListener.State.FAILED || state == ConnectionListener.State.CLOSED) { - // Disconnect from the host here, otherwise the next time connectToHost() is called, - // it will try to disconnect, triggering an incorrect status notification. - - // TODO(lambroslambrou): Connection state notifications for separate sessions should - // go to separate Client instances. Once this is true, we can remove this line and - // simplify the disconnectFromHost() code. - disconnectFromHostWithoutNotification(); - } - } - - /** - * Called by JniInterface (from native code) to prompt the user to enter a PIN. Called on the - * UI thread. - */ - void displayAuthenticationPrompt(boolean pairingSupported) { - mAuthenticator.displayAuthenticationPrompt(pairingSupported); - } - - /** - * Called by the SessionAuthenticator after the user enters a PIN. - * @param pin The entered PIN. - * @param createPair Whether to create a new pairing for this client. - * @param deviceName The device name to appear in the pairing registry. Only used if createPair - * is true. - */ - public void handleAuthenticationResponse( - String pin, boolean createPair, String deviceName) { - assert mConnected; - JniInterface.nativeAuthenticationResponse(pin, createPair, deviceName); - } - - /** - * Called by JniInterface (from native code), to save newly-received pairing credentials to - * permanent storage. Called on the UI thread. - */ - void commitPairingCredentials(String host, String id, String secret) { - mAuthenticator.commitPairingCredentials(host, id, secret); - } - - /** - * Moves the mouse cursor, possibly while clicking the specified (nonnegative) button. Called - * on the UI thread. - */ - public void sendMouseEvent(int x, int y, int whichButton, boolean buttonDown) { - if (!mConnected) { - return; - } - - JniInterface.nativeSendMouseEvent(x, y, whichButton, buttonDown); - } - - /** Injects a mouse-wheel event with delta values. Called on the UI thread. */ - public void sendMouseWheelEvent(int deltaX, int deltaY) { - if (!mConnected) { - return; - } - - JniInterface.nativeSendMouseWheelEvent(deltaX, deltaY); - } - - /** - * Presses or releases the specified key. Called on the UI thread. If scanCode is not zero then - * keyCode is ignored. - */ - public boolean sendKeyEvent(int scanCode, int keyCode, boolean keyDown) { - if (!mConnected) { - return false; - } - - return JniInterface.nativeSendKeyEvent(scanCode, keyCode, keyDown); - } - - /** Sends TextEvent to the host. Called on the UI thread. */ - public void sendTextEvent(String text) { - if (!mConnected) { - return; - } - - JniInterface.nativeSendTextEvent(text); - } - - /** Sends an array of TouchEvents to the host. Called on the UI thread. */ - public void sendTouchEvent(TouchEventData.EventType eventType, TouchEventData[] data) { - if (!mConnected) { - return; - } - - JniInterface.nativeSendTouchEvent(eventType.value(), data); - } - - /** - * Enables or disables the video channel. Called on the UI thread in response to Activity - * lifecycle events. - */ - public void enableVideoChannel(boolean enable) { - if (!mConnected) { - return; - } - - JniInterface.nativeEnableVideoChannel(enable); - } - - /** - * Sets the redraw callback to the provided functor. Provide a value of null whenever the - * window is no longer visible so that we don't continue to draw onto it. Called on the UI - * thread. - */ - public void provideRedrawCallback(Runnable redrawCallback) { - mRedrawCallback = redrawCallback; - } - - /** Forces the native graphics thread to redraw to the canvas. Called on the UI thread. */ - public boolean redrawGraphics() { - if (!mConnected || mRedrawCallback == null) return false; - - JniInterface.nativeScheduleRedraw(); - return true; - } - - /** - * Called by JniInterface to perform the redrawing callback requested by - * {@link #redrawGraphics}. This is a no-op if the window isn't visible (the callback is null). - * Called on the graphics thread. - */ - void redrawGraphicsInternal() { - Runnable callback = mRedrawCallback; - if (callback != null) { - callback.run(); - } - } - - /** - * Returns a bitmap of the latest video frame. Called on the native graphics thread when - * DesktopView is repainted. - */ - public Bitmap getVideoFrame() { - if (Looper.myLooper() == Looper.getMainLooper()) { - Log.w(TAG, "Canvas being redrawn on UI thread"); - } - - synchronized (mFrameLock) { - return mFrameBitmap; - } - } - - /** - * Called by JniInterface (from native code) to set a new video frame. Called on the native - * graphics thread when a new frame is allocated. - */ - void setVideoFrame(Bitmap bitmap) { - if (Looper.myLooper() == Looper.getMainLooper()) { - Log.w(TAG, "Video frame updated on UI thread"); - } - - synchronized (mFrameLock) { - mFrameBitmap = bitmap; - } - } - - /** - * Creates a new Bitmap to hold video frame pixels. Called by JniInterface (from native code), - * and the returned Bitmap is referenced by native code which writes the decoded frame pixels - * to it. - */ - static Bitmap newBitmap(int width, int height) { - return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - } - - /** - * Called by JniInterface (from native code) to update the cursor shape. This is called on the - * graphics thread when receiving a new cursor shape from the host. - */ - void updateCursorShape( - int width, int height, int hotspotX, int hotspotY, ByteBuffer buffer) { - mCursorHotspot = new Point(hotspotX, hotspotY); - - int[] data = new int[width * height]; - buffer.order(ByteOrder.LITTLE_ENDIAN); - buffer.asIntBuffer().get(data, 0, data.length); - mCursorBitmap = Bitmap.createBitmap(data, width, height, Bitmap.Config.ARGB_8888); - } - - /** Position of cursor hotspot within cursor image. Called on the graphics thread. */ - public Point getCursorHotspot() { - return mCursorHotspot; - } - - /** Returns the current cursor shape. Called on the graphics thread. */ - public Bitmap getCursorBitmap() { - return mCursorBitmap; - } - - // - // Third Party Authentication - // - - /** - * Called by JniInterface (from native code), to pop up a third party login page to fetch the - * token required for authentication. - */ - void fetchThirdPartyToken(String tokenUrl, String clientId, String scope) { - mAuthenticator.fetchThirdPartyToken(tokenUrl, clientId, scope); - } - - /** - * Called by the SessionAuthenticator to pass the |token| and |sharedSecret| to native code to - * continue authentication. - */ - public void onThirdPartyTokenFetched(String token, String sharedSecret) { - if (!mConnected) { - return; - } - - JniInterface.nativeOnThirdPartyTokenFetched(token, sharedSecret); - } - - // - // Host and Client Capabilities - // - - /** - * Called by JniInterface (from native code) to set the list of negotiated capabilities between - * host and client. Called on the UI thread. - */ - void setCapabilities(String capabilities) { - mCapabilityManager.setNegotiatedCapabilities(capabilities); - } - - // - // Extension Message Handling - // - - /** - * Called by JniInterface (from native code), to pass on the deconstructed ExtensionMessage to - * the app. Called on the UI thread. - */ - void handleExtensionMessage(String type, String data) { - mCapabilityManager.onExtensionMessage(type, data); - } - - /** Sends an extension message to the Chromoting host. Called on the UI thread. */ - public void sendExtensionMessage(String type, String data) { - if (!mConnected) { - return; - } - - JniInterface.nativeSendExtensionMessage(type, data); - } }
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java index 92a1447..0238702 100644 --- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java +++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
@@ -6,12 +6,18 @@ import android.content.Context; import android.graphics.Bitmap; +import android.graphics.Point; +import android.os.Looper; import org.chromium.base.ContextUtils; +import org.chromium.base.Log; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; +import org.chromium.chromoting.CapabilityManager; +import org.chromium.chromoting.SessionAuthenticator; import java.nio.ByteBuffer; +import java.nio.ByteOrder; /** * Initializes the Chromium remoting library, and provides JNI calls into it. @@ -19,12 +25,47 @@ */ @JNINamespace("remoting") public class JniInterface { + private static final String TAG = "Chromoting"; + /* * Library-loading state machine. */ /** Whether the library has been loaded. Accessed on the UI thread. */ private static boolean sLoaded = false; + /** Used for authentication-related UX during connection. Accessed on the UI thread. */ + private static SessionAuthenticator sAuthenticator; + + /* + * Connection-initiating state machine. + */ + /** Whether the native code is attempting a connection. Accessed on the UI thread. */ + private static boolean sConnected = false; + + /** Notified upon successful connection or disconnection. Accessed on the UI thread. */ + private static ConnectionListener sConnectionListener = null; + + /** + * Callback invoked on the graphics thread to repaint the desktop. Accessed on the UI and + * graphics threads. + */ + private static Runnable sRedrawCallback = null; + + /** Bitmap holding a copy of the latest video frame. Accessed on the UI and graphics threads. */ + private static Bitmap sFrameBitmap = null; + + /** Protects access to sFrameBitmap. */ + private static final Object sFrameLock = new Object(); + + /** Position of cursor hot-spot. Accessed on the graphics thread. */ + private static Point sCursorHotspot = new Point(); + + /** Bitmap holding the cursor shape. Accessed on the graphics thread. */ + private static Bitmap sCursorBitmap = null; + + /** Capability Manager through which capabilities and extensions are handled. */ + private static CapabilityManager sCapabilityManager = CapabilityManager.getInstance(); + /** * To be called once from the main Activity. Loads and initializes the native code. * Called on the UI thread. @@ -49,65 +90,203 @@ public static native String nativeGetClientId(); public static native String nativeGetClientSecret(); + /** Returns whether the client is connected. */ + public static boolean isConnected() { + return sConnected; + } + + /** Attempts to form a connection to the user-selected host. Called on the UI thread. */ + public static void connectToHost(String username, String authToken, String hostJid, + String hostId, String hostPubkey, SessionAuthenticator authenticator, String flags, + ConnectionListener listener) { + disconnectFromHost(); + + sConnectionListener = listener; + sAuthenticator = authenticator; + nativeConnect(username, authToken, hostJid, hostId, hostPubkey, + sAuthenticator.getPairingId(hostId), sAuthenticator.getPairingSecret(hostId), + sCapabilityManager.getLocalCapabilities(), flags); + sConnected = true; + } + /** Performs the native portion of the connection. */ - static native void nativeConnect(String username, String authToken, String hostJid, + private static native void nativeConnect(String username, String authToken, String hostJid, String hostId, String hostPubkey, String pairId, String pairSecret, String capabilities, String flags); + /** Severs the connection and cleans up. Called on the UI thread. */ + public static void disconnectFromHost() { + if (!sConnected) { + return; + } + + sConnectionListener.onConnectionState( + ConnectionListener.State.CLOSED, ConnectionListener.Error.OK); + + disconnectFromHostWithoutNotification(); + } + + /** Same as disconnectFromHost() but without notifying the ConnectionListener. */ + private static void disconnectFromHostWithoutNotification() { + if (!sConnected) { + return; + } + + nativeDisconnect(); + sConnectionListener = null; + sConnected = false; + sCapabilityManager.onHostDisconnect(); + + // Drop the reference to free the Bitmap for GC. + synchronized (sFrameLock) { + sFrameBitmap = null; + } + } + /** Performs the native portion of the cleanup. */ - static native void nativeDisconnect(); + private static native void nativeDisconnect(); /** Called by native code whenever the connection status changes. Called on the UI thread. */ @CalledByNative private static void onConnectionState(int stateCode, int errorCode) { - if (Client.getInstance() != null) { - Client.getInstance().onConnectionState(stateCode, errorCode); + ConnectionListener.State state = ConnectionListener.State.fromValue(stateCode); + ConnectionListener.Error error = ConnectionListener.Error.fromValue(errorCode); + sConnectionListener.onConnectionState(state, error); + if (state == ConnectionListener.State.FAILED || state == ConnectionListener.State.CLOSED) { + // Disconnect from the host here, otherwise the next time connectToHost() is called, + // it will try to disconnect, triggering an incorrect status notification. + disconnectFromHostWithoutNotification(); } } /** Prompts the user to enter a PIN. Called on the UI thread. */ @CalledByNative private static void displayAuthenticationPrompt(boolean pairingSupported) { - if (Client.getInstance() != null) { - Client.getInstance().displayAuthenticationPrompt(pairingSupported); - } + sAuthenticator.displayAuthenticationPrompt(pairingSupported); } - /** Native implementation of Client.handleAuthenticationResponse(). */ - static native void nativeAuthenticationResponse( + /** + * Performs the native response to the user's PIN. + * @param pin The entered PIN. + * @param createPair Whether to create a new pairing for this client. + * @param deviceName The device name to appear in the pairing registry. Only used if createPair + * is true. + */ + public static void handleAuthenticationResponse( + String pin, boolean createPair, String deviceName) { + assert sConnected; + nativeAuthenticationResponse(pin, createPair, deviceName); + } + + /** Native implementation of handleAuthenticationResponse(). */ + private static native void nativeAuthenticationResponse( String pin, boolean createPair, String deviceName); /** Saves newly-received pairing credentials to permanent storage. Called on the UI thread. */ @CalledByNative private static void commitPairingCredentials(String host, String id, String secret) { - if (Client.getInstance() != null) { - Client.getInstance().commitPairingCredentials(host, id, secret); + sAuthenticator.commitPairingCredentials(host, id, secret); + } + + /** + * Moves the mouse cursor, possibly while clicking the specified (nonnegative) button. Called + * on the UI thread. + */ + public static void sendMouseEvent(int x, int y, int whichButton, boolean buttonDown) { + if (!sConnected) { + return; } + + nativeSendMouseEvent(x, y, whichButton, buttonDown); } /** Passes mouse information to the native handling code. */ - static native void nativeSendMouseEvent( + private static native void nativeSendMouseEvent( int x, int y, int whichButton, boolean buttonDown); + /** Injects a mouse-wheel event with delta values. Called on the UI thread. */ + public static void sendMouseWheelEvent(int deltaX, int deltaY) { + if (!sConnected) { + return; + } + + nativeSendMouseWheelEvent(deltaX, deltaY); + } + /** Passes mouse-wheel information to the native handling code. */ - static native void nativeSendMouseWheelEvent(int deltaX, int deltaY); + private static native void nativeSendMouseWheelEvent(int deltaX, int deltaY); + + /** + * Presses or releases the specified (nonnegative) key. Called on the UI thread. If scanCode + * is not zero then keyCode is ignored. + */ + public static boolean sendKeyEvent(int scanCode, int keyCode, boolean keyDown) { + if (!sConnected) { + return false; + } + + return nativeSendKeyEvent(scanCode, keyCode, keyDown); + } /** * Passes key press information to the native handling code. */ - static native boolean nativeSendKeyEvent(int scanCode, int keyCode, boolean keyDown); + private static native boolean nativeSendKeyEvent(int scanCode, int keyCode, boolean keyDown); + + /** Sends TextEvent to the host. Called on the UI thread. */ + public static void sendTextEvent(String text) { + if (!sConnected) { + return; + } + + nativeSendTextEvent(text); + } /** Passes text event information to the native handling code. */ - static native void nativeSendTextEvent(String text); + private static native void nativeSendTextEvent(String text); + + /** Sends an array of TouchEvents to the host. Called on the UI thread. */ + public static void sendTouchEvent(TouchEventData.EventType eventType, TouchEventData[] data) { + nativeSendTouchEvent(eventType.value(), data); + } /** Passes touch event information to the native handling code. */ - static native void nativeSendTouchEvent(int eventType, TouchEventData[] data); + private static native void nativeSendTouchEvent(int eventType, TouchEventData[] data); - /** Native implementation of Client.enableVideoChannel() */ - static native void nativeEnableVideoChannel(boolean enable); + /** + * Enables or disables the video channel. Called on the UI thread in response to Activity + * lifecycle events. + */ + public static void enableVideoChannel(boolean enable) { + if (!sConnected) { + return; + } + + nativeEnableVideoChannel(enable); + } + + /** Native implementation of enableVideoChannel() */ + private static native void nativeEnableVideoChannel(boolean enable); + + /** + * Sets the redraw callback to the provided functor. Provide a value of null whenever the + * window is no longer visible so that we don't continue to draw onto it. Called on the UI + * thread. + */ + public static void provideRedrawCallback(Runnable redrawCallback) { + sRedrawCallback = redrawCallback; + } + + /** Forces the native graphics thread to redraw to the canvas. Called on the UI thread. */ + public static boolean redrawGraphics() { + if (!sConnected || sRedrawCallback == null) return false; + + nativeScheduleRedraw(); + return true; + } /** Schedules a redraw on the native graphics thread. */ - static native void nativeScheduleRedraw(); + private static native void nativeScheduleRedraw(); /** * Performs the redrawing callback. This is a no-op if the window isn't visible. Called on the @@ -115,9 +294,23 @@ */ @CalledByNative private static void redrawGraphicsInternal() { - Client client = Client.getInstance(); - if (client != null) { - client.redrawGraphicsInternal(); + Runnable callback = sRedrawCallback; + if (callback != null) { + callback.run(); + } + } + + /** + * Returns a bitmap of the latest video frame. Called on the native graphics thread when + * DesktopView is repainted. + */ + public static Bitmap getVideoFrame() { + if (Looper.myLooper() == Looper.getMainLooper()) { + Log.w(TAG, "Canvas being redrawn on UI thread"); + } + + synchronized (sFrameLock) { + return sFrameBitmap; } } @@ -126,9 +319,12 @@ */ @CalledByNative private static void setVideoFrame(Bitmap bitmap) { - Client client = Client.getInstance(); - if (client != null) { - client.setVideoFrame(bitmap); + if (Looper.myLooper() == Looper.getMainLooper()) { + Log.w(TAG, "Video frame updated on UI thread"); + } + + synchronized (sFrameLock) { + sFrameBitmap = bitmap; } } @@ -138,7 +334,7 @@ */ @CalledByNative private static Bitmap newBitmap(int width, int height) { - return Client.newBitmap(width, height); + return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); } /** @@ -146,12 +342,24 @@ * shape from the host. */ @CalledByNative - private static void updateCursorShape( + public static void updateCursorShape( int width, int height, int hotspotX, int hotspotY, ByteBuffer buffer) { - Client client = Client.getInstance(); - if (client != null) { - client.updateCursorShape(width, height, hotspotX, hotspotY, buffer); - } + sCursorHotspot = new Point(hotspotX, hotspotY); + + int[] data = new int[width * height]; + buffer.order(ByteOrder.LITTLE_ENDIAN); + buffer.asIntBuffer().get(data, 0, data.length); + sCursorBitmap = Bitmap.createBitmap(data, width, height, Bitmap.Config.ARGB_8888); + } + + /** Position of cursor hotspot within cursor image. Called on the graphics thread. */ + public static Point getCursorHotspot() { + return sCursorHotspot; + } + + /** Returns the current cursor shape. Called on the graphics thread. */ + public static Bitmap getCursorBitmap() { + return sCursorBitmap; } // @@ -160,14 +368,23 @@ /** Pops up a third party login page to fetch the token required for authentication. */ @CalledByNative - private static void fetchThirdPartyToken(String tokenUrl, String clientId, String scope) { - if (Client.getInstance() != null) { - Client.getInstance().fetchThirdPartyToken(tokenUrl, clientId, scope); + public static void fetchThirdPartyToken(String tokenUrl, String clientId, String scope) { + sAuthenticator.fetchThirdPartyToken(tokenUrl, clientId, scope); + } + + /** + * Notify the native code to continue authentication with the |token| and the |sharedSecret|. + */ + public static void onThirdPartyTokenFetched(String token, String sharedSecret) { + if (!sConnected) { + return; } + + nativeOnThirdPartyTokenFetched(token, sharedSecret); } /** Passes authentication data to the native handling code. */ - static native void nativeOnThirdPartyTokenFetched(String token, String sharedSecret); + private static native void nativeOnThirdPartyTokenFetched(String token, String sharedSecret); // // Host and Client Capabilities @@ -175,10 +392,8 @@ /** Set the list of negotiated capabilities between host and client. Called on the UI thread. */ @CalledByNative - private static void setCapabilities(String capabilities) { - if (Client.getInstance() != null) { - Client.getInstance().setCapabilities(capabilities); - } + public static void setCapabilities(String capabilities) { + sCapabilityManager.setNegotiatedCapabilities(capabilities); } // @@ -187,12 +402,18 @@ /** Passes on the deconstructed ExtensionMessage to the app. Called on the UI thread. */ @CalledByNative - private static void handleExtensionMessage(String type, String data) { - if (Client.getInstance() != null) { - Client.getInstance().handleExtensionMessage(type, data); - } + public static void handleExtensionMessage(String type, String data) { + sCapabilityManager.onExtensionMessage(type, data); } - /** Passes extension message to the native code. */ - static native void nativeSendExtensionMessage(String type, String data); + /** Sends an extension message to the Chromoting host. Called on the UI thread. */ + public static void sendExtensionMessage(String type, String data) { + if (!sConnected) { + return; + } + + nativeSendExtensionMessage(type, data); + } + + private static native void nativeSendExtensionMessage(String type, String data); }
diff --git a/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java b/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java index 3dea369..c7774f7 100644 --- a/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java +++ b/remoting/android/javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java
@@ -197,10 +197,7 @@ public void setUp() { mRenderData = new RenderData(); mRemoteInputInjector = new MockRemoteInputInjector(); - - // TODO(lambroslambrou): Provide a mock Client implementation that doesn't call out to JNI, - // and mock the Client methods instead of using MockRemoteInputInjector here. - mInputStrategy = new TouchInputStrategy(mRenderData, null); + mInputStrategy = new TouchInputStrategy(mRenderData); mInputStrategy.setRemoteInputInjectorForTest(mRemoteInputInjector); mEventGenerator = new TouchEventGenerator();
diff --git a/remoting/host/cast_extension_session.cc b/remoting/host/cast_extension_session.cc index f9c6bb6..b602178 100644 --- a/remoting/host/cast_extension_session.cc +++ b/remoting/host/cast_extension_session.cc
@@ -19,9 +19,9 @@ #include "remoting/protocol/port_allocator_factory.h" #include "remoting/protocol/transport_context.h" #include "remoting/protocol/webrtc_video_capturer_adapter.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h" -#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" +#include "third_party/webrtc/api/test/fakeconstraints.h" +#include "third_party/webrtc/api/videosourceinterface.h" namespace remoting {
diff --git a/remoting/host/cast_extension_session.h b/remoting/host/cast_extension_session.h index e584abea..18e4b27 100644 --- a/remoting/host/cast_extension_session.h +++ b/remoting/host/cast_extension_session.h
@@ -15,7 +15,7 @@ #include "base/values.h" #include "jingle/glue/thread_wrapper.h" #include "remoting/host/host_extension_session.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" #include "third_party/webrtc/base/scoped_ref_ptr.h" #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
diff --git a/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc b/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc index bea275e4..bb7a29c 100644 --- a/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc +++ b/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc
@@ -132,7 +132,8 @@ .WillOnce( InvokeWithoutArgs( CreateFunctor( - dialog(), &StubIt2MeConfirmationDialog::ReportResult, + &StubIt2MeConfirmationDialog::ReportResult, + base::Unretained(dialog()), It2MeConfirmationDialog::Result::CANCEL))); EXPECT_CALL(callback_target,
diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc index 840c2d54..ba27372 100644 --- a/remoting/host/win/worker_process_launcher_unittest.cc +++ b/remoting/host/win/worker_process_launcher_unittest.cc
@@ -424,7 +424,8 @@ EXPECT_CALL(server_listener_, OnChannelConnected(_)) .Times(2) .WillOnce(InvokeWithoutArgs(CreateFunctor( - this, &WorkerProcessLauncherTest::TerminateWorker, + &WorkerProcessLauncherTest::TerminateWorker, + base::Unretained(this), CONTROL_C_EXIT))) .WillOnce(InvokeWithoutArgs(this, &WorkerProcessLauncherTest::StopWorker)); @@ -470,7 +471,8 @@ EXPECT_CALL(server_listener_, OnChannelConnected(_)) .Times(1) .WillOnce(InvokeWithoutArgs(CreateFunctor( - this, &WorkerProcessLauncherTest::TerminateWorker, + &WorkerProcessLauncherTest::TerminateWorker, + base::Unretained(this), kMinPermanentErrorExitCode))); EXPECT_CALL(server_listener_, OnPermanentError(_)) .Times(1) @@ -498,7 +500,8 @@ EXPECT_CALL(client_listener_, OnCrash(_, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(CreateFunctor( - this, &WorkerProcessLauncherTest::TerminateWorker, + &WorkerProcessLauncherTest::TerminateWorker, + base::Unretained(this), EXCEPTION_BREAKPOINT))); StartWorker();
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc index 3173dcf..1febc42 100644 --- a/remoting/protocol/webrtc_connection_to_client.cc +++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -23,10 +23,10 @@ #include "remoting/protocol/webrtc_transport.h" #include "remoting/protocol/webrtc_video_capturer_adapter.h" #include "remoting/protocol/webrtc_video_stream.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h" -#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" +#include "third_party/webrtc/api/test/fakeconstraints.h" +#include "third_party/webrtc/api/videosourceinterface.h" namespace remoting { namespace protocol {
diff --git a/remoting/protocol/webrtc_data_stream_adapter.h b/remoting/protocol/webrtc_data_stream_adapter.h index a05a149..9d6262d5 100644 --- a/remoting/protocol/webrtc_data_stream_adapter.h +++ b/remoting/protocol/webrtc_data_stream_adapter.h
@@ -12,7 +12,7 @@ #include "base/memory/weak_ptr.h" #include "remoting/protocol/errors.h" #include "remoting/protocol/message_channel_factory.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" #include "third_party/webrtc/base/refcount.h" namespace rtc {
diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc index eb13567..105330c 100644 --- a/remoting/protocol/webrtc_transport.cc +++ b/remoting/protocol/webrtc_transport.cc
@@ -15,7 +15,7 @@ #include "jingle/glue/thread_wrapper.h" #include "remoting/protocol/stream_message_pipe_adapter.h" #include "remoting/protocol/transport_context.h" -#include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h" +#include "third_party/webrtc/api/test/fakeconstraints.h" #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" #include "third_party/webrtc/modules/audio_device/include/fake_audio_device.h"
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h index 7762691..bf42467 100644 --- a/remoting/protocol/webrtc_transport.h +++ b/remoting/protocol/webrtc_transport.h
@@ -16,7 +16,7 @@ #include "remoting/protocol/transport.h" #include "remoting/protocol/webrtc_data_stream_adapter.h" #include "remoting/signaling/signal_strategy.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" namespace webrtc { class FakeAudioDeviceModule;
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.h b/remoting/protocol/webrtc_video_renderer_adapter.h index 87efcc97..e9cbb72f 100644 --- a/remoting/protocol/webrtc_video_renderer_adapter.h +++ b/remoting/protocol/webrtc_video_renderer_adapter.h
@@ -7,7 +7,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" namespace base { class SingleThreadTaskRunner;
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc index 07e215e..f377613 100644 --- a/remoting/protocol/webrtc_video_stream.cc +++ b/remoting/protocol/webrtc_video_stream.cc
@@ -6,10 +6,10 @@ #include "base/logging.h" #include "remoting/protocol/webrtc_video_capturer_adapter.h" -#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h" -#include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h" -#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" +#include "third_party/webrtc/api/mediastreaminterface.h" +#include "third_party/webrtc/api/peerconnectioninterface.h" +#include "third_party/webrtc/api/test/fakeconstraints.h" +#include "third_party/webrtc/api/videosourceinterface.h" namespace remoting { namespace protocol {
diff --git a/sql/mojo/sql_test_base.cc b/sql/mojo/sql_test_base.cc index ab37af2..baecd048 100644 --- a/sql/mojo/sql_test_base.cc +++ b/sql/mojo/sql_test_base.cc
@@ -137,7 +137,7 @@ void SQLTestBase::SetUp() { ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:filesystem", &files_); + shell()->ConnectToInterface("mojo:filesystem", &files_); filesystem::FileError error = filesystem::FileError::FAILED; filesystem::DirectoryPtr directory;
diff --git a/sql/mojo/vfs_unittest.cc b/sql/mojo/vfs_unittest.cc index 9bbaf04..395f7ba 100644 --- a/sql/mojo/vfs_unittest.cc +++ b/sql/mojo/vfs_unittest.cc
@@ -53,7 +53,7 @@ void SetUp() override { mojo::test::ApplicationTestBase::SetUp(); - shell()->ConnectToService("mojo:filesystem", &files_); + shell()->ConnectToInterface("mojo:filesystem", &files_); filesystem::FileError error = filesystem::FileError::FAILED; filesystem::DirectoryPtr directory;
diff --git a/sync/api/metadata_batch.cc b/sync/api/metadata_batch.cc index 072ad5e..a172d1e 100644 --- a/sync/api/metadata_batch.cc +++ b/sync/api/metadata_batch.cc
@@ -18,11 +18,11 @@ metadata_map_.insert(std::make_pair(client_tag, metadata)); } -const DataTypeState& MetadataBatch::GetDataTypeState() const { +const sync_pb::DataTypeState& MetadataBatch::GetDataTypeState() const { return state_; } -void MetadataBatch::SetDataTypeState(const DataTypeState& state) { +void MetadataBatch::SetDataTypeState(const sync_pb::DataTypeState& state) { state_ = state; }
diff --git a/sync/api/metadata_batch.h b/sync/api/metadata_batch.h index 56ab2a7..dd4b8d0 100644 --- a/sync/api/metadata_batch.h +++ b/sync/api/metadata_batch.h
@@ -6,9 +6,10 @@ #define SYNC_API_METADATA_BATCH_H_ #include <map> +#include <string> #include "sync/base/sync_export.h" -#include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/protocol/entity_metadata.pb.h" namespace syncer_v2 { @@ -32,14 +33,14 @@ const sync_pb::EntityMetadata& metadata); // Get the DataTypeState for this batch. - const DataTypeState& GetDataTypeState() const; + const sync_pb::DataTypeState& GetDataTypeState() const; // Set the DataTypeState for this batch. - void SetDataTypeState(const DataTypeState& state); + void SetDataTypeState(const sync_pb::DataTypeState& state); private: EntityMetadataMap metadata_map_; - DataTypeState state_; + sync_pb::DataTypeState state_; }; } // namespace syncer_v2
diff --git a/sync/api/metadata_change_list.h b/sync/api/metadata_change_list.h index a8c0d95e..53c8e242 100644 --- a/sync/api/metadata_change_list.h +++ b/sync/api/metadata_change_list.h
@@ -10,11 +10,11 @@ #include "sync/base/sync_export.h" namespace sync_pb { +class DataTypeState; class EntityMetadata; } // namespace sync_pb namespace syncer_v2 { -struct DataTypeState; // Interface used by the processor and service to communicate about metadata. // The purpose of the interface is to record changes to data type global and @@ -30,7 +30,8 @@ virtual ~MetadataChangeList() {} // Requests DataTypeState to be updated in the storage. - virtual void UpdateDataTypeState(const DataTypeState& data_type_state) = 0; + virtual void UpdateDataTypeState( + const sync_pb::DataTypeState& data_type_state) = 0; // Requests DataTypeState to be cleared from the storage. virtual void ClearDataTypeState() = 0;
diff --git a/sync/engine/model_type_worker.cc b/sync/engine/model_type_worker.cc index e661588..5b6e7eb 100644 --- a/sync/engine/model_type_worker.cc +++ b/sync/engine/model_type_worker.cc
@@ -33,7 +33,7 @@ ModelTypeWorker::ModelTypeWorker( ModelType type, - const DataTypeState& initial_state, + const sync_pb::DataTypeState& initial_state, const UpdateResponseDataList& saved_pending_updates, scoped_ptr<Cryptographer> cryptographer, NudgeHandler* nudge_handler, @@ -45,7 +45,7 @@ nudge_handler_(nudge_handler), weak_ptr_factory_(this) { // Request an initial sync if it hasn't been completed yet. - if (!data_type_state_.initial_sync_done) { + if (!data_type_state_.initial_sync_done()) { nudge_handler_->NudgeForInitialDownload(type_); } @@ -94,13 +94,13 @@ void ModelTypeWorker::GetDownloadProgress( sync_pb::DataTypeProgressMarker* progress_marker) const { DCHECK(CalledOnValidThread()); - progress_marker->CopyFrom(data_type_state_.progress_marker); + progress_marker->CopyFrom(data_type_state_.progress_marker()); } void ModelTypeWorker::GetDataTypeContext( sync_pb::DataTypeContext* context) const { DCHECK(CalledOnValidThread()); - context->CopyFrom(data_type_state_.type_context); + context->CopyFrom(data_type_state_.type_context()); } SyncerError ModelTypeWorker::ProcessGetUpdatesResponse( @@ -111,8 +111,8 @@ DCHECK(CalledOnValidThread()); // TODO(rlarocque): Handle data type context conflicts. - data_type_state_.type_context = mutated_context; - data_type_state_.progress_marker = progress_marker; + *data_type_state_.mutable_type_context() = mutated_context; + *data_type_state_.mutable_progress_marker() = progress_marker; UpdateResponseDataList response_datas; UpdateResponseDataList pending_updates; @@ -206,10 +206,10 @@ // got a response with changes_remaining == 0. If this is our first download // cycle, we should update our state so the ModelTypeProcessor knows that // it's safe to commit items now. - if (!data_type_state_.initial_sync_done) { + if (!data_type_state_.initial_sync_done()) { DVLOG(1) << "Delivering 'initial sync done' ping."; - data_type_state_.initial_sync_done = true; + data_type_state_.set_initial_sync_done(true); model_type_processor_->OnUpdateReceived( data_type_state_, UpdateResponseDataList(), UpdateResponseDataList()); @@ -271,7 +271,8 @@ return scoped_ptr<CommitContribution>(); return scoped_ptr<CommitContribution>(new NonBlockingTypeCommitContribution( - data_type_state_.type_context, commit_entities, sequence_numbers, this)); + data_type_state_.type_context(), commit_entities, sequence_numbers, + this)); } void ModelTypeWorker::StorePendingCommit(const CommitRequestData& request) { @@ -327,8 +328,8 @@ } bool ModelTypeWorker::IsTypeInitialized() const { - return data_type_state_.initial_sync_done && - !data_type_state_.progress_marker.token().empty(); + return data_type_state_.initial_sync_done() && + !data_type_state_.progress_marker().token().empty(); } bool ModelTypeWorker::CanCommitItems() const { @@ -392,10 +393,11 @@ const std::string& new_key_name = cryptographer_->GetDefaultNigoriKeyName(); // Handle a change in encryption key. - if (data_type_state_.encryption_key_name != new_key_name) { + if (data_type_state_.encryption_key_name() != new_key_name) { DVLOG(1) << ModelTypeToString(type_) << ": Updating encryption key " - << data_type_state_.encryption_key_name << " -> " << new_key_name; - data_type_state_.encryption_key_name = new_key_name; + << data_type_state_.encryption_key_name() << " -> " + << new_key_name; + data_type_state_.set_encryption_key_name(new_key_name); new_encryption_key = true; }
diff --git a/sync/engine/model_type_worker.h b/sync/engine/model_type_worker.h index ee6e3dc..be0430f4 100644 --- a/sync/engine/model_type_worker.h +++ b/sync/engine/model_type_worker.h
@@ -21,6 +21,7 @@ #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/non_blocking_sync_common.h" #include "sync/internal_api/public/sync_encryption_handler.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/protocol/sync.pb.h" #include "sync/util/cryptographer.h" @@ -59,7 +60,7 @@ public base::NonThreadSafe { public: ModelTypeWorker(syncer::ModelType type, - const DataTypeState& initial_state, + const sync_pb::DataTypeState& initial_state, const UpdateResponseDataList& saved_pending_updates, scoped_ptr<syncer::Cryptographer> cryptographer, syncer::NudgeHandler* nudge_handler, @@ -139,7 +140,7 @@ syncer::ModelType type_; // State that applies to the entire model type. - DataTypeState data_type_state_; + sync_pb::DataTypeState data_type_state_; // Pointer to the ModelTypeProcessor associated with this worker. // This is NULL when no proxy is connected..
diff --git a/sync/engine/model_type_worker_unittest.cc b/sync/engine/model_type_worker_unittest.cc index cc452d8..cd19fc5 100644 --- a/sync/engine/model_type_worker_unittest.cc +++ b/sync/engine/model_type_worker_unittest.cc
@@ -13,6 +13,7 @@ #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/model_type_processor.h" #include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/protocol/sync.pb.h" #include "sync/sessions/status_controller.h" #include "sync/syncable/syncable_util.h" @@ -84,7 +85,7 @@ const UpdateResponseDataList& initial_pending_updates); // Initialize with a custom initial DataTypeState and pending updates. - void InitializeWithState(const DataTypeState& state, + void InitializeWithState(const sync_pb::DataTypeState& state, const UpdateResponseDataList& pending_updates); // Introduce a new key that the local cryptographer can't decrypt. @@ -148,7 +149,7 @@ size_t GetNumModelThreadUpdateResponses() const; UpdateResponseDataList GetNthModelThreadUpdateResponse(size_t n) const; UpdateResponseDataList GetNthModelThreadPendingUpdates(size_t n) const; - DataTypeState GetNthModelThreadUpdateState(size_t n) const; + sync_pb::DataTypeState GetNthModelThreadUpdateState(size_t n) const; // Reads the latest update response datas on the model thread. // Note that if the model thread is in non-blocking mode, this data will not @@ -162,7 +163,7 @@ // be updated until the response is actually processed by the model thread. size_t GetNumModelThreadCommitResponses() const; CommitResponseDataList GetNthModelThreadCommitResponse(size_t n) const; - DataTypeState GetNthModelThreadCommitState(size_t n) const; + sync_pb::DataTypeState GetNthModelThreadCommitState(size_t n) const; // Reads the latest commit response datas on the model thread. // Note that if the model thread is in non-blocking mode, this data will not @@ -243,8 +244,8 @@ ModelTypeWorkerTest::~ModelTypeWorkerTest() {} void ModelTypeWorkerTest::FirstInitialize() { - DataTypeState initial_state; - initial_state.progress_marker.set_data_type_id( + sync_pb::DataTypeState initial_state; + initial_state.mutable_progress_marker()->set_data_type_id( GetSpecificsFieldNumberFromModelType(kModelType)); InitializeWithState(initial_state, UpdateResponseDataList()); @@ -256,12 +257,13 @@ void ModelTypeWorkerTest::InitializeWithPendingUpdates( const UpdateResponseDataList& initial_pending_updates) { - DataTypeState initial_state; - initial_state.progress_marker.set_data_type_id( + sync_pb::DataTypeState initial_state; + initial_state.mutable_progress_marker()->set_data_type_id( GetSpecificsFieldNumberFromModelType(kModelType)); - initial_state.progress_marker.set_token("some_saved_progress_token"); + initial_state.mutable_progress_marker()->set_token( + "some_saved_progress_token"); - initial_state.initial_sync_done = true; + initial_state.set_initial_sync_done(true); InitializeWithState(initial_state, initial_pending_updates); @@ -269,7 +271,7 @@ } void ModelTypeWorkerTest::InitializeWithState( - const DataTypeState& state, + const sync_pb::DataTypeState& state, const UpdateResponseDataList& initial_pending_updates) { DCHECK(!worker_); @@ -513,7 +515,7 @@ return mock_type_processor_->GetNthPendingUpdates(n); } -DataTypeState ModelTypeWorkerTest::GetNthModelThreadUpdateState( +sync_pb::DataTypeState ModelTypeWorkerTest::GetNthModelThreadUpdateState( size_t n) const { DCHECK_LT(n, GetNumModelThreadUpdateResponses()); return mock_type_processor_->GetNthTypeStateReceivedInUpdateResponse(n); @@ -541,7 +543,7 @@ return mock_type_processor_->GetNthCommitResponse(n); } -DataTypeState ModelTypeWorkerTest::GetNthModelThreadCommitState( +sync_pb::DataTypeState ModelTypeWorkerTest::GetNthModelThreadCommitState( size_t n) const { DCHECK_LT(n, GetNumModelThreadCommitResponses()); return mock_type_processor_->GetNthTypeStateReceivedInCommitResponse(n); @@ -768,9 +770,9 @@ EXPECT_EQ(0U, GetNthModelThreadUpdateResponse(0).size()); EXPECT_EQ(0U, GetNthModelThreadUpdateResponse(1).size()); - const DataTypeState& state = GetNthModelThreadUpdateState(1); - EXPECT_FALSE(state.progress_marker.token().empty()); - EXPECT_TRUE(state.initial_sync_done); + const sync_pb::DataTypeState& state = GetNthModelThreadUpdateState(1); + EXPECT_FALSE(state.progress_marker().token().empty()); + EXPECT_TRUE(state.initial_sync_done()); } // Commit two new entities in two separate commit messages. @@ -851,7 +853,7 @@ ASSERT_EQ(1U, GetNumModelThreadUpdateResponses()); EXPECT_EQ(GetLocalCryptographerKeyName(), - GetNthModelThreadUpdateState(0).encryption_key_name); + GetNthModelThreadUpdateState(0).encryption_key_name()); // Normal commit request stuff. CommitRequest("tag1", "value1"); @@ -952,7 +954,7 @@ // necessary. ASSERT_EQ(1U, GetNumModelThreadUpdateResponses()); EXPECT_EQ(GetLocalCryptographerKeyName(), - GetNthModelThreadUpdateState(0).encryption_key_name); + GetNthModelThreadUpdateState(0).encryption_key_name()); } // Receive updates that are initially undecryptable, then ensure they get
diff --git a/sync/internal_api/public/activation_context.h b/sync/internal_api/public/activation_context.h index 798d8514..48d9476 100644 --- a/sync/internal_api/public/activation_context.h +++ b/sync/internal_api/public/activation_context.h
@@ -11,6 +11,7 @@ #include "sync/base/sync_export.h" #include "sync/internal_api/public/model_type_processor.h" #include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" namespace syncer_v2 { @@ -21,7 +22,7 @@ ~ActivationContext(); // Initial DataTypeState at the moment of activation. - DataTypeState data_type_state; + sync_pb::DataTypeState data_type_state; // Pending updates from the previous session. // TODO(stanisc): crbug.com/529498: should remove pending updates.
diff --git a/sync/internal_api/public/model_type_processor.h b/sync/internal_api/public/model_type_processor.h index 121055f..297b48f 100644 --- a/sync/internal_api/public/model_type_processor.h +++ b/sync/internal_api/public/model_type_processor.h
@@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "sync/base/sync_export.h" #include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" namespace syncer_v2 { class CommitQueue; @@ -24,13 +25,13 @@ // Informs this object that some of its commit requests have been // successfully serviced. virtual void OnCommitCompleted( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) = 0; // Informs this object that there are some incoming updates is should // handle. virtual void OnUpdateReceived( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) = 0; };
diff --git a/sync/internal_api/public/non_blocking_sync_common.cc b/sync/internal_api/public/non_blocking_sync_common.cc index f76895c..a8ad64f3 100644 --- a/sync/internal_api/public/non_blocking_sync_common.cc +++ b/sync/internal_api/public/non_blocking_sync_common.cc
@@ -6,10 +6,6 @@ namespace syncer_v2 { -DataTypeState::DataTypeState() {} - -DataTypeState::~DataTypeState() {} - CommitRequestData::CommitRequestData() {} CommitRequestData::~CommitRequestData() {}
diff --git a/sync/internal_api/public/non_blocking_sync_common.h b/sync/internal_api/public/non_blocking_sync_common.h index 799dfca..b12ff014 100644 --- a/sync/internal_api/public/non_blocking_sync_common.h +++ b/sync/internal_api/public/non_blocking_sync_common.h
@@ -19,32 +19,6 @@ static const int64_t kUncommittedVersion = -1; -// Data-type global state that must be accessed and updated on the sync thread, -// but persisted on or through the model thread. -struct SYNC_EXPORT DataTypeState { - DataTypeState(); - ~DataTypeState(); - - // The latest progress markers received from the server. - sync_pb::DataTypeProgressMarker progress_marker; - - // A data type context. Sent to the server in every commit or update - // request. May be updated by either by responses from the server or - // requests made on the model thread. The interpretation of this value may - // be data-type specific. Many data types ignore it. - sync_pb::DataTypeContext type_context; - - // This value is set if this type's data should be encrypted on the server. - // If this key changes, the client will need to re-commit all of its local - // data to the server using the new encryption key. - std::string encryption_key_name; - - // This flag is set to true when the first download cycle is complete. The - // ModelTypeProcessor should not attempt to commit any items until this - // flag is set. - bool initial_sync_done = false; -}; - struct SYNC_EXPORT CommitRequestData { CommitRequestData(); ~CommitRequestData();
diff --git a/sync/internal_api/public/shared_model_type_processor.h b/sync/internal_api/public/shared_model_type_processor.h index 855e964..0d8ba15 100644 --- a/sync/internal_api/public/shared_model_type_processor.h +++ b/sync/internal_api/public/shared_model_type_processor.h
@@ -20,6 +20,7 @@ #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/model_type_processor.h" #include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/protocol/sync.pb.h" namespace syncer_v2 { @@ -85,9 +86,9 @@ // ModelTypeProcessor implementation. void OnConnect(scoped_ptr<CommitQueue> worker) override; - void OnCommitCompleted(const DataTypeState& type_state, + void OnCommitCompleted(const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) override; - void OnUpdateReceived(const DataTypeState& type_state, + void OnUpdateReceived(const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) override; @@ -101,7 +102,7 @@ void FinishStart(); // Handle the first update received from the server after being enabled. - void OnInitialUpdateReceived(const DataTypeState& type_state, + void OnInitialUpdateReceived(const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates); @@ -114,7 +115,7 @@ void ClearTransientSyncState(); syncer::ModelType type_; - DataTypeState data_type_state_; + sync_pb::DataTypeState data_type_state_; // Stores the start callback in between Start() and FinishStart(). StartCallback start_callback_;
diff --git a/sync/internal_api/public/simple_metadata_change_list.cc b/sync/internal_api/public/simple_metadata_change_list.cc index c1bb25f..999eda6 100644 --- a/sync/internal_api/public/simple_metadata_change_list.cc +++ b/sync/internal_api/public/simple_metadata_change_list.cc
@@ -11,7 +11,7 @@ SimpleMetadataChangeList::~SimpleMetadataChangeList() {} void SimpleMetadataChangeList::UpdateDataTypeState( - const DataTypeState& data_type_state) { + const sync_pb::DataTypeState& data_type_state) { // TODO(skym): Implementation. }
diff --git a/sync/internal_api/public/simple_metadata_change_list.h b/sync/internal_api/public/simple_metadata_change_list.h index aca0e69e..f302b12f 100644 --- a/sync/internal_api/public/simple_metadata_change_list.h +++ b/sync/internal_api/public/simple_metadata_change_list.h
@@ -5,6 +5,8 @@ #ifndef SYNC_INTERNAL_API_PUBLIC_SIMPLE_METADATA_CHANGE_LIST_H_ #define SYNC_INTERNAL_API_PUBLIC_SIMPLE_METADATA_CHANGE_LIST_H_ +#include <string> + #include "sync/api/metadata_change_list.h" #include "sync/api/model_type_store.h" #include "sync/base/sync_export.h" @@ -19,7 +21,8 @@ SimpleMetadataChangeList(); ~SimpleMetadataChangeList() override; - void UpdateDataTypeState(const DataTypeState& data_type_state) override; + void UpdateDataTypeState( + const sync_pb::DataTypeState& data_type_state) override; void ClearDataTypeState() override; void UpdateMetadata(const std::string& client_tag, const sync_pb::EntityMetadata& metadata) override;
diff --git a/sync/internal_api/public/test/fake_metadata_change_list.h b/sync/internal_api/public/test/fake_metadata_change_list.h index 6359602a..3941f0a 100644 --- a/sync/internal_api/public/test/fake_metadata_change_list.h +++ b/sync/internal_api/public/test/fake_metadata_change_list.h
@@ -5,10 +5,12 @@ #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_ #define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_METADATA_CHANGE_LIST_H_ +#include <string> #include <vector> #include "sync/api/metadata_change_list.h" #include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/protocol/entity_metadata.pb.h" namespace syncer_v2 { @@ -22,7 +24,8 @@ FakeMetadataChangeList(); ~FakeMetadataChangeList() override; - void UpdateDataTypeState(const DataTypeState& data_type_state) override; + void UpdateDataTypeState( + const sync_pb::DataTypeState& data_type_state) override; void ClearDataTypeState() override; void UpdateMetadata(const std::string& client_tag, const sync_pb::EntityMetadata& metadata) override; @@ -41,7 +44,7 @@ Action action; std::string tag; - DataTypeState data_type_state; + sync_pb::DataTypeState data_type_state; sync_pb::EntityMetadata metadata; };
diff --git a/sync/internal_api/shared_model_type_processor.cc b/sync/internal_api/shared_model_type_processor.cc index dbf7bf8..4b6b983 100644 --- a/sync/internal_api/shared_model_type_processor.cc +++ b/sync/internal_api/shared_model_type_processor.cc
@@ -26,9 +26,9 @@ ~ModelTypeProcessorProxy() override; void OnConnect(scoped_ptr<CommitQueue> worker) override; - void OnCommitCompleted(const DataTypeState& type_state, + void OnCommitCompleted(const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) override; - void OnUpdateReceived(const DataTypeState& type_state, + void OnUpdateReceived(const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) override; @@ -51,7 +51,7 @@ } void ModelTypeProcessorProxy::OnCommitCompleted( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) { processor_task_runner_->PostTask( FROM_HERE, base::Bind(&ModelTypeProcessor::OnCommitCompleted, processor_, @@ -59,7 +59,7 @@ } void ModelTypeProcessorProxy::OnUpdateReceived( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) { processor_task_runner_->PostTask( @@ -101,7 +101,7 @@ DCHECK(entities_.empty()); DCHECK(!IsConnected()); - if (batch->GetDataTypeState().initial_sync_done) { + if (batch->GetDataTypeState().initial_sync_done()) { EntityMetadataMap metadata_map(batch->TakeAllMetadata()); for (auto it = metadata_map.begin(); it != metadata_map.end(); it++) { entities_.insert(std::make_pair( @@ -114,7 +114,7 @@ // we have data but no metadata? } else { // First time syncing; initialize metadata. - data_type_state_.progress_marker.set_data_type_id( + data_type_state_.mutable_progress_marker()->set_data_type_id( GetSpecificsFieldNumberFromModelType(type_)); } @@ -274,7 +274,7 @@ return; // Don't send anything if the type is not ready to handle commits. - if (!data_type_state_.initial_sync_done) + if (!data_type_state_.initial_sync_done()) return; // TODO(rlarocque): Do something smarter than iterate here. @@ -292,7 +292,7 @@ } void SharedModelTypeProcessor::OnCommitCompleted( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) { scoped_ptr<MetadataChangeList> change_list = service_->CreateMetadataChangeList(); @@ -311,9 +311,10 @@ << " type: " << type_ << " client_tag: " << client_tag_hash; return; } else { - it->second->ReceiveCommitResponse( - response_data.id, response_data.sequence_number, - response_data.response_version, data_type_state_.encryption_key_name); + it->second->ReceiveCommitResponse(response_data.id, + response_data.sequence_number, + response_data.response_version, + data_type_state_.encryption_key_name()); // TODO(stanisc): crbug.com/573333: Delete case. // This might be the right place to clear a metadata entry that has // been deleted locally and confirmed deleted by the server. @@ -329,11 +330,10 @@ } void SharedModelTypeProcessor::OnUpdateReceived( - const DataTypeState& data_type_state, + const sync_pb::DataTypeState& data_type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) { - - if (!data_type_state_.initial_sync_done) { + if (!data_type_state_.initial_sync_done()) { OnInitialUpdateReceived(data_type_state, response_list, pending_updates); } @@ -342,8 +342,9 @@ EntityChangeList entity_changes; metadata_changes->UpdateDataTypeState(data_type_state); - bool got_new_encryption_requirements = data_type_state_.encryption_key_name != - data_type_state.encryption_key_name; + bool got_new_encryption_requirements = + data_type_state_.encryption_key_name() != + data_type_state.encryption_key_name(); data_type_state_ = data_type_state; for (auto list_it = response_list.begin(); list_it != response_list.end(); @@ -401,14 +402,14 @@ // If the received entity has out of date encryption, we schedule another // commit to fix it. - if (data_type_state_.encryption_key_name != + if (data_type_state_.encryption_key_name() != response_data.encryption_key_name) { DVLOG(2) << ModelTypeToString(type_) << ": Requesting re-encrypt commit " << response_data.encryption_key_name << " -> " - << data_type_state_.encryption_key_name; + << data_type_state_.encryption_key_name(); auto it2 = entities_.find(client_tag_hash); it2->second->UpdateDesiredEncryptionKey( - data_type_state_.encryption_key_name); + data_type_state_.encryption_key_name()); } } @@ -435,7 +436,7 @@ if (got_new_encryption_requirements) { for (auto it = entities_.begin(); it != entities_.end(); ++it) { it->second->UpdateDesiredEncryptionKey( - data_type_state_.encryption_key_name); + data_type_state_.encryption_key_name()); } } @@ -448,7 +449,7 @@ } void SharedModelTypeProcessor::OnInitialUpdateReceived( - const DataTypeState& data_type_state, + const sync_pb::DataTypeState& data_type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) { // TODO(maxbogue): crbug.com/569675: Generate metadata for all entities.
diff --git a/sync/internal_api/shared_model_type_processor_unittest.cc b/sync/internal_api/shared_model_type_processor_unittest.cc index 741cfda..776179a 100644 --- a/sync/internal_api/shared_model_type_processor_unittest.cc +++ b/sync/internal_api/shared_model_type_processor_unittest.cc
@@ -16,6 +16,7 @@ #include "sync/internal_api/public/non_blocking_sync_common.h" #include "sync/internal_api/public/test/fake_metadata_change_list.h" #include "sync/internal_api/public/test/fake_model_type_service.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/protocol/sync.pb.h" #include "sync/syncable/syncable_util.h" #include "sync/test/engine/mock_commit_queue.h" @@ -168,7 +169,7 @@ MockCommitQueue* mock_queue_; scoped_ptr<MockCommitQueue> mock_queue_ptr_; - DataTypeState data_type_state_; + sync_pb::DataTypeState data_type_state_; // The last received EntityChangeList. scoped_ptr<EntityChangeList> entity_change_list_; @@ -188,7 +189,7 @@ SharedModelTypeProcessorTest::~SharedModelTypeProcessorTest() {} void SharedModelTypeProcessorTest::InitializeToReadyState() { - data_type_state_.initial_sync_done = true; + data_type_state_.set_initial_sync_done(true); OnMetadataLoaded(); Start(); // TODO(maxbogue): crbug.com/569642: Remove this once entity data is loaded @@ -261,7 +262,7 @@ } void SharedModelTypeProcessorTest::OnInitialSyncDone() { - data_type_state_.initial_sync_done = true; + data_type_state_.set_initial_sync_done(true); UpdateResponseDataList empty_update_list; // TODO(stanisc): crbug/569645: replace this with loading the initial state @@ -352,7 +353,7 @@ void SharedModelTypeProcessorTest::UpdateDesiredEncryptionKey( const std::string& key_name) { - data_type_state_.encryption_key_name = key_name; + data_type_state_.set_encryption_key_name(key_name); type_processor()->OnUpdateReceived(data_type_state_, UpdateResponseDataList(), UpdateResponseDataList()); } @@ -561,7 +562,7 @@ entity_data->specifics.mutable_preference()->set_value("value2"); entity_data->non_unique_name = "name2"; entity_data->client_tag_hash = "hash"; - // TODO (skym): Consider removing this. The ID should never be changed by the + // TODO(skym): Consider removing this. The ID should never be changed by the // client once established. entity_data->id = "cid2"; @@ -588,7 +589,7 @@ const FakeMetadataChangeList::Record& record2 = change_list.GetNthRecord(1); EXPECT_EQ(FakeMetadataChangeList::UPDATE_METADATA, record2.action); EXPECT_EQ("tag1", record2.tag); - // TODO (skym): Is this correct? + // TODO(skym): Is this correct? EXPECT_EQ("cid1", record2.metadata.server_id()); EXPECT_EQ("hash", record2.metadata.client_tag_hash()); @@ -919,11 +920,11 @@ // Once we're ready to commit, all three local items should consider // themselves uncommitted and pending for commit. // TODO(maxbogue): crbug.com/569645: Fix when data is loaded. - EXPECT_EQ(1U, GetNumCommitRequestLists()); - EXPECT_EQ(3U, GetNthCommitRequestList(0).size()); - EXPECT_TRUE(HasCommitRequestForTag("tag1")); - EXPECT_TRUE(HasCommitRequestForTag("tag2")); - EXPECT_TRUE(HasCommitRequestForTag("tag3")); + EXPECT_EQ(1U, GetNumCommitRequestLists()); + EXPECT_EQ(3U, GetNthCommitRequestList(0).size()); + EXPECT_TRUE(HasCommitRequestForTag("tag1")); + EXPECT_TRUE(HasCommitRequestForTag("tag2")); + EXPECT_TRUE(HasCommitRequestForTag("tag3")); } // Test receipt of pending updates.
diff --git a/sync/internal_api/test/fake_metadata_change_list.cc b/sync/internal_api/test/fake_metadata_change_list.cc index 407066d7..ceba2cb 100644 --- a/sync/internal_api/test/fake_metadata_change_list.cc +++ b/sync/internal_api/test/fake_metadata_change_list.cc
@@ -17,7 +17,7 @@ FakeMetadataChangeList::Record::~Record() {} void FakeMetadataChangeList::UpdateDataTypeState( - const DataTypeState& data_type_state) { + const sync_pb::DataTypeState& data_type_state) { Record record; record.action = UPDATE_DATA_TYPE_STATE; record.data_type_state = data_type_state;
diff --git a/sync/protocol/data_type_state.proto b/sync/protocol/data_type_state.proto new file mode 100644 index 0000000..ffe9326 --- /dev/null +++ b/sync/protocol/data_type_state.proto
@@ -0,0 +1,34 @@ +// Copyright 2016 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. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +import "sync.proto"; + +// Sync proto to store data type global metadata in model type storage. +message DataTypeState { + // The latest progress markers received from the server. + optional DataTypeProgressMarker progress_marker = 1; + + // A data type context. Sent to the server in every commit or update + // request. May be updated by either responses from the server or requests + // made on the model thread. The interpretation of this value may be + // data-type specific. Many data types ignore it. + optional DataTypeContext type_context = 2; + + // This value is set if this type's data should be encrypted on the server. + // If this key changes, the client will need to re-commit all of its local + // data to the server using the new encryption key. + optional string encryption_key_name = 3; + + // This flag is set to true when the first download cycle is complete. The + // ModelTypeProcessor should not attempt to commit any items until this + // flag is set. + optional bool initial_sync_done = 4; +}
diff --git a/sync/protocol/protocol.gypi b/sync/protocol/protocol.gypi index 21aa65df9..183b7db0 100644 --- a/sync/protocol/protocol.gypi +++ b/sync/protocol/protocol.gypi
@@ -21,6 +21,7 @@ '<(sync_proto_sources_dir)/bookmark_specifics.proto', '<(sync_proto_sources_dir)/client_commands.proto', '<(sync_proto_sources_dir)/client_debug_info.proto', + '<(sync_proto_sources_dir)/data_type_state.proto', '<(sync_proto_sources_dir)/device_info_specifics.proto', '<(sync_proto_sources_dir)/dictionary_specifics.proto', '<(sync_proto_sources_dir)/encryption.proto',
diff --git a/sync/sessions/model_type_registry_unittest.cc b/sync/sessions/model_type_registry_unittest.cc index d5b620e..079b37b 100644 --- a/sync/sessions/model_type_registry_unittest.cc +++ b/sync/sessions/model_type_registry_unittest.cc
@@ -13,6 +13,7 @@ #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/shared_model_type_processor.h" #include "sync/internal_api/public/test/fake_model_type_service.h" +#include "sync/protocol/data_type_state.pb.h" #include "sync/test/engine/fake_model_worker.h" #include "sync/test/engine/mock_nudge_handler.h" #include "sync/test/engine/test_directory_setter_upper.h" @@ -29,15 +30,15 @@ ModelTypeRegistry* registry(); - static syncer_v2::DataTypeState MakeInitialDataTypeState(ModelType type) { - syncer_v2::DataTypeState state; - state.progress_marker.set_data_type_id( + static sync_pb::DataTypeState MakeInitialDataTypeState(ModelType type) { + sync_pb::DataTypeState state; + state.mutable_progress_marker()->set_data_type_id( GetSpecificsFieldNumberFromModelType(type)); return state; } static scoped_ptr<syncer_v2::ActivationContext> MakeActivationContext( - const syncer_v2::DataTypeState& data_type_state, + const sync_pb::DataTypeState& data_type_state, const syncer_v2::UpdateResponseDataList& saved_pending_updates, scoped_ptr<syncer_v2::ModelTypeProcessor> type_processor) { scoped_ptr<syncer_v2::ActivationContext> context =
diff --git a/sync/test/engine/mock_model_type_processor.cc b/sync/test/engine/mock_model_type_processor.cc index d4249e2..c22a847ce 100644 --- a/sync/test/engine/mock_model_type_processor.cc +++ b/sync/test/engine/mock_model_type_processor.cc
@@ -23,7 +23,7 @@ } void MockModelTypeProcessor::OnCommitCompleted( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) { base::Closure task = base::Bind(&MockModelTypeProcessor::OnCommitCompletedImpl, @@ -36,7 +36,7 @@ } void MockModelTypeProcessor::OnUpdateReceived( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) { base::Closure task = base::Bind(&MockModelTypeProcessor::OnUpdateReceivedImpl, @@ -135,7 +135,8 @@ return received_pending_updates_[n]; } -DataTypeState MockModelTypeProcessor::GetNthTypeStateReceivedInUpdateResponse( +sync_pb::DataTypeState +MockModelTypeProcessor::GetNthTypeStateReceivedInUpdateResponse( size_t n) const { DCHECK_LT(n, GetNumUpdateResponses()); return type_states_received_on_update_[n]; @@ -151,7 +152,8 @@ return received_commit_responses_[n]; } -DataTypeState MockModelTypeProcessor::GetNthTypeStateReceivedInCommitResponse( +sync_pb::DataTypeState +MockModelTypeProcessor::GetNthTypeStateReceivedInCommitResponse( size_t n) const { DCHECK_LT(n, GetNumCommitResponses()); return type_states_received_on_commit_[n]; @@ -188,7 +190,7 @@ } void MockModelTypeProcessor::OnCommitCompletedImpl( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) { received_commit_responses_.push_back(response_list); type_states_received_on_commit_.push_back(type_state); @@ -203,7 +205,7 @@ } void MockModelTypeProcessor::OnUpdateReceivedImpl( - const DataTypeState& type_state, + const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) { received_update_responses_.push_back(response_list);
diff --git a/sync/test/engine/mock_model_type_processor.h b/sync/test/engine/mock_model_type_processor.h index 120dedc8..a5a168e9 100644 --- a/sync/test/engine/mock_model_type_processor.h +++ b/sync/test/engine/mock_model_type_processor.h
@@ -16,6 +16,7 @@ #include "base/macros.h" #include "sync/internal_api/public/model_type_processor.h" #include "sync/internal_api/public/non_blocking_sync_common.h" +#include "sync/protocol/data_type_state.pb.h" namespace syncer_v2 { @@ -37,9 +38,9 @@ // Implementation of ModelTypeProcessor. void OnConnect(scoped_ptr<CommitQueue> commit_queue) override; - void OnCommitCompleted(const DataTypeState& type_state, + void OnCommitCompleted(const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list) override; - void OnUpdateReceived(const DataTypeState& type_state, + void OnUpdateReceived(const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) override; @@ -71,14 +72,16 @@ size_t GetNumUpdateResponses() const; UpdateResponseDataList GetNthUpdateResponse(size_t n) const; UpdateResponseDataList GetNthPendingUpdates(size_t n) const; - DataTypeState GetNthTypeStateReceivedInUpdateResponse(size_t n) const; + sync_pb::DataTypeState GetNthTypeStateReceivedInUpdateResponse( + size_t n) const; // Getters to access the log of received commit responses. // // Does not includes repsonses that are in pending tasks. size_t GetNumCommitResponses() const; CommitResponseDataList GetNthCommitResponse(size_t n) const; - DataTypeState GetNthTypeStateReceivedInCommitResponse(size_t n) const; + sync_pb::DataTypeState GetNthTypeStateReceivedInCommitResponse( + size_t n) const; // Getters to access the lastest update response for a given tag_hash. bool HasUpdateResponse(const std::string& tag_hash) const; @@ -92,13 +95,13 @@ // Process a received commit response. // // Implemented as an Impl method so we can defer its execution in some cases. - void OnCommitCompletedImpl(const DataTypeState& type_state, + void OnCommitCompletedImpl(const sync_pb::DataTypeState& type_state, const CommitResponseDataList& response_list); // Process a received update response. // // Implemented as an Impl method so we can defer its execution in some cases. - void OnUpdateReceivedImpl(const DataTypeState& type_state, + void OnUpdateReceivedImpl(const sync_pb::DataTypeState& type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates); @@ -125,8 +128,8 @@ std::vector<CommitResponseDataList> received_commit_responses_; std::vector<UpdateResponseDataList> received_update_responses_; std::vector<UpdateResponseDataList> received_pending_updates_; - std::vector<DataTypeState> type_states_received_on_update_; - std::vector<DataTypeState> type_states_received_on_commit_; + std::vector<sync_pb::DataTypeState> type_states_received_on_update_; + std::vector<sync_pb::DataTypeState> type_states_received_on_commit_; // Latest responses received, indexed by tag_hash. std::map<const std::string, CommitResponseData> commit_response_items_;
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index b89dfa6..1297d5e 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -410,6 +410,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -535,6 +538,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -660,6 +666,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -785,6 +794,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -910,6 +922,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -1035,6 +1050,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -1169,6 +1187,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" } @@ -1294,6 +1315,9 @@ "instrumentation_tests": [ { "apk_under_test": "Blimp.apk", + "override_compile_targets": [ + "blimp_test_apk" + ], "test": "blimp_test_apk", "test_apk": "BlimpTest.apk" }
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index ef4b88b..b0aa47c 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -254,6 +254,20 @@ "test": "unit_tests" } ], + "instrumentation_tests": [ + { + "test": "AndroidWebViewTest" + }, + { + "test": "ChromePublicTest" + }, + { + "test": "ContentShellTest" + }, + { + "test": "ChromeSyncShellTest" + } + ], "scripts": [ { "name": "webview_licenses", @@ -379,6 +393,20 @@ "test": "unit_tests" } ], + "instrumentation_tests": [ + { + "test": "AndroidWebViewTest" + }, + { + "test": "ChromePublicTest" + }, + { + "test": "ContentShellTest" + }, + { + "test": "ChromeSyncShellTest" + } + ], "scripts": [ { "name": "webview_licenses",
diff --git a/testing/buildbot/filters/browser-side-navigation.linux.content_browsertests.filter b/testing/buildbot/filters/browser-side-navigation.linux.content_browsertests.filter index d82ef2a..a88a884 100644 --- a/testing/buildbot/filters/browser-side-navigation.linux.content_browsertests.filter +++ b/testing/buildbot/filters/browser-side-navigation.linux.content_browsertests.filter
@@ -16,7 +16,6 @@ -NavigationControllerBrowserTest.StopCausesFailureDespiteJavaScriptURL -NavigationControllerBrowserTest.SubframeBackFromReplaceState -NavigationHandleImplBrowserTest.VerifySrcdoc --RenderFrameHostManagerTest.ConsecutiveNavigationsToSite -RenderFrameHostManagerTest.RestoreSubframeFileAccessForHistoryNavigation -RenderViewImplTest.BrowserNavigationStartNotUsedForHistoryNavigation -RenderViewImplTest.DecideNavigationPolicy
diff --git a/testing/generate_gmock_mutant.py b/testing/generate_gmock_mutant.py deleted file mode 100755 index b881cd9..0000000 --- a/testing/generate_gmock_mutant.py +++ /dev/null
@@ -1,451 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2012 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. - -import string -import sys - -HEADER = """\ -// 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. - -// This file automatically generated by testing/generate_gmock_mutant.py. -// DO NOT EDIT. - -#ifndef TESTING_GMOCK_MUTANT_H_ -#define TESTING_GMOCK_MUTANT_H_ - -// The intention of this file is to make possible using GMock actions in -// all of its syntactic beauty. Classes and helper functions can be used as -// more generic variants of Task and Callback classes (see base/task.h) -// Mutant supports both pre-bound arguments (like Task) and call-time -// arguments (like Callback) - hence the name. :-) -// -// DispatchToMethod/Function supports two sets of arguments: pre-bound (P) and -// call-time (C). The arguments as well as the return type are templatized. -// DispatchToMethod/Function will also try to call the selected method or -// function even if provided pre-bound arguments does not match exactly with -// the function signature hence the X1, X2 ... XN parameters in CreateFunctor. -// DispatchToMethod will try to invoke method that may not belong to the -// object's class itself but to the object's class base class. -// -// Additionally you can bind the object at calltime by binding a pointer to -// pointer to the object at creation time - before including this file you -// have to #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING. -// -// TODO(stoyan): It's yet not clear to me should we use T& and T&* instead -// of T* and T** when we invoke CreateFunctor to match the EXPECT_CALL style. -// -// -// Sample usage with gMock: -// -// struct Mock : public ObjectDelegate { -// MOCK_METHOD2(string, OnRequest(int n, const string& request)); -// MOCK_METHOD1(void, OnQuit(int exit_code)); -// MOCK_METHOD2(void, LogMessage(int level, const string& message)); -// -// string HandleFlowers(const string& reply, int n, const string& request) { -// string result = SStringPrintf("In request of %d %s ", n, request); -// for (int i = 0; i < n; ++i) result.append(reply) -// return result; -// } -// -// void DoLogMessage(int level, const string& message) { -// } -// -// void QuitMessageLoop(int seconds) { -// base::MessageLoop* loop = base::MessageLoop::current(); -// loop->PostDelayedTask(FROM_HERE, -// base::MessageLoop::QuitWhenIdleClosure(), -// 1000 * seconds); -// } -// }; -// -// Mock mock; -// // Will invoke mock.HandleFlowers("orchids", n, request) -// // "orchids" is a pre-bound argument, and <n> and <request> are call-time -// // arguments - they are not known until the OnRequest mock is invoked. -// EXPECT_CALL(mock, OnRequest(Ge(5), base::StartsWith("flower")) -// .Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, -// string("orchids")))); -// -// -// // No pre-bound arguments, two call-time arguments passed -// // directly to DoLogMessage -// EXPECT_CALL(mock, OnLogMessage(_, _)) -// .Times(AnyNumber()) -// .WillAlways(Invoke(CreateFunctor, &mock, &Mock::DoLogMessage)); -// -// -// // In this case we have a single pre-bound argument - 3. We ignore -// // all of the arguments of OnQuit. -// EXCEPT_CALL(mock, OnQuit(_)) -// .Times(1) -// .WillOnce(InvokeWithoutArgs(CreateFunctor( -// &mock, &Mock::QuitMessageLoop, 3))); -// -// MessageLoop loop; -// loop.Run(); -// -// -// // Here is another example of how we can set an action that invokes -// // method of an object that is not yet created. -// struct Mock : public ObjectDelegate { -// MOCK_METHOD1(void, DemiurgeCreated(Demiurge*)); -// MOCK_METHOD2(void, OnRequest(int count, const string&)); -// -// void StoreDemiurge(Demiurge* w) { -// demiurge_ = w; -// } -// -// Demiurge* demiurge; -// } -// -// EXPECT_CALL(mock, DemiurgeCreated(_)).Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::StoreDemiurge))); -// -// EXPECT_CALL(mock, OnRequest(_, StrEq("Moby Dick"))) -// .Times(AnyNumber()) -// .WillAlways(WithArgs<0>(Invoke( -// CreateFunctor(&mock->demiurge_, &Demiurge::DecreaseMonsters)))); -// - -#include "base/memory/linked_ptr.h" -#include "base/tuple.h" - -namespace testing {""" - -MUTANT = """\ - -// Interface that is exposed to the consumer, that does the actual calling -// of the method. -template <typename R, typename Params> -class MutantRunner { - public: - virtual R RunWithParams(const Params& params) = 0; - virtual ~MutantRunner() {} -}; - -// Mutant holds pre-bound arguments (like Task). Like Callback -// allows call-time arguments. You bind a pointer to the object -// at creation time. -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class Mutant : public MutantRunner<R, Params> { - public: - Mutant(T* obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToMethod<R>(this->obj_, this->method_, pb_, params); - } - - T* obj_; - Method method_; - PreBound pb_; -}; - -template <typename R, typename Function, typename PreBound, typename Params> -class MutantFunction : public MutantRunner<R, Params> { - public: - MutantFunction(Function function, const PreBound& pb) - : function_(function), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToFunction<R>(function_, pb_, params); - } - - Function function_; - PreBound pb_; -}; - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -// MutantLateBind is like Mutant, but you bind a pointer to a pointer -// to the object. This way you can create actions for an object -// that is not yet created (has only storage for a pointer to it). -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class MutantLateObjectBind : public MutantRunner<R, Params> { - public: - MutantLateObjectBind(T** obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation. - virtual R RunWithParams(const Params& params) { - EXPECT_THAT(*this->obj_, testing::NotNull()); - if (NULL == *this->obj_) - return R(); - return DispatchToMethod<R>( *this->obj_, this->method_, pb_, params); - } - - T** obj_; - Method method_; - PreBound pb_; -}; -#endif - -// Simple MutantRunner<> wrapper acting as a functor. -// Redirects operator() to MutantRunner<Params>::Run() -template <typename R, typename Params> -struct MutantFunctor { - explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) { - } - - ~MutantFunctor() { - } - - inline R operator()() { - return impl_->RunWithParams(base::Tuple<>()); - } - - template <typename Arg1> - inline R operator()(const Arg1& a) { - return impl_->RunWithParams(Params(a)); - } - - template <typename Arg1, typename Arg2> - inline R operator()(const Arg1& a, const Arg2& b) { - return impl_->RunWithParams(Params(a, b)); - } - - template <typename Arg1, typename Arg2, typename Arg3> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c) { - return impl_->RunWithParams(Params(a, b, c)); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c, - const Arg4& d) { - return impl_->RunWithParams(Params(a, b, c, d)); - } - - private: - // We need copy constructor since MutantFunctor is copied few times - // inside GMock machinery, hence no DISALLOW_EVIL_CONTRUCTORS - MutantFunctor(); - linked_ptr<MutantRunner<R, Params> > impl_; -}; -""" - -FOOTER = """\ -} // namespace testing - -#endif // TESTING_GMOCK_MUTANT_H_""" - -# Templates for DispatchToMethod/DispatchToFunction functions. -# template_params - typename P1, typename P2.. typename C1.. -# prebound - Tuple<P1, .. PN> -# calltime - Tuple<C1, .. CN> -# args - p.a, p.b.., c.a, c.b.. -DISPATCH_TO_METHOD_TEMPLATE = """\ -template <typename R, typename T, typename Method, %(template_params)s> -inline R DispatchToMethod(T* obj, Method method, - const %(prebound)s& p, - const %(calltime)s& c) { - return (obj->*method)(%(args)s); -} -""" - -DISPATCH_TO_FUNCTION_TEMPLATE = """\ -template <typename R, typename Function, %(template_params)s> -inline R DispatchToFunction(Function function, - const %(prebound)s& p, - const %(calltime)s& c) { - return (*function)(%(args)s); -} -""" - -# Templates for CreateFunctor functions. -# template_params - typename P1, typename P2.. typename C1.. typename X1.. -# prebound - Tuple<P1, .. PN> -# calltime - Tuple<A1, .. AN> -# params - X1,.. , A1, .. -# args - const P1& p1 .. -# call_args - p1, p2, p3.. -CREATE_METHOD_FUNCTOR_TEMPLATE = """\ -template <typename R, typename T, typename U, %(template_params)s> -inline MutantFunctor<R, %(calltime)s> -CreateFunctor(T* obj, R (U::*method)(%(params)s), %(args)s) { - MutantRunner<R, %(calltime)s>* t = - new Mutant<R, T, R (U::*)(%(params)s), - %(prebound)s, %(calltime)s> - (obj, method, base::MakeTuple(%(call_args)s)); - return MutantFunctor<R, %(calltime)s>(t); -} -""" - -CREATE_FUNCTION_FUNCTOR_TEMPLATE = """\ -template <typename R, %(template_params)s> -inline MutantFunctor<R, %(calltime)s> -CreateFunctor(R (*function)(%(params)s), %(args)s) { - MutantRunner<R, %(calltime)s>* t = - new MutantFunction<R, R (*)(%(params)s), - %(prebound)s, %(calltime)s> - (function, base::MakeTuple(%(call_args)s)); - return MutantFunctor<R, %(calltime)s>(t); -} -""" - -def SplitLine(line, width): - """Splits a single line at comma, at most |width| characters long.""" - if len(line) <= width: - return (line, None) - n = 1 + line[:width].rfind(",") - if n == 0: # If comma cannot be found give up and return the entire line. - return (line, None) - # Assume there is a space after the comma - assert line[n] == " " - return (line[:n], line[n + 1:]) - - -def Wrap(s, width, subsequent_offset): - """Wraps a single line |s| at commas so every line is at most |width| - characters long. - """ - w = [] - spaces = " " * subsequent_offset - while s: - (f, s) = SplitLine(s, width) - w.append(f) - if s: - s = spaces + s - return "\n".join(w) - - -def Clean(s): - """Cleans artifacts from generated C++ code. - - Our simple string formatting/concatenation may introduce extra commas. - """ - s = s.replace(", >", ">") - s = s.replace(", )", ")") - return s - - -def ExpandPattern(pattern, it): - """Return list of expanded pattern strings. - - Each string is created by replacing all '%' in |pattern| with element of |it|. - """ - return [pattern.replace("%", x) for x in it] - - -def Gen(pattern, n, start): - """Expands pattern replacing '%' with sequential integers starting with start. - - Expanded patterns will be joined with comma separator. - Gen("X%", 3, 1) will return "X1, X2, X3". - """ - it = string.hexdigits[start:n + start] - return ", ".join(ExpandPattern(pattern, it)) - - -def Merge(a): - return ", ".join(filter(len, a)) - - -def GenTuple(pattern, n): - return Clean("base::Tuple<%s>" % (Gen(pattern, n, 1))) - - -def FixCode(s): - lines = Clean(s).splitlines() - # Wrap sometimes very long 1st line to be inside the "template <" - lines[0] = Wrap(lines[0], 80, 10) - - # Wrap all subsequent lines to 6 spaces arbitrarily. This is a 2-space line - # indent, plus a 4 space continuation indent. - for line in xrange(1, len(lines)): - lines[line] = Wrap(lines[line], 80, 6) - return "\n".join(lines) - - -def GenerateDispatch(prebound, calltime): - print "\n// %d - %d" % (prebound, calltime) - args = { - "template_params": Merge([Gen("typename P%", prebound, 1), - Gen("typename C%", calltime, 1)]), - "prebound": GenTuple("P%", prebound), - "calltime": GenTuple("C%", calltime), - "args": Merge([Gen("base::get<%>(p)", prebound, 0), - Gen("base::get<%>(c)", calltime, 0)]), - } - - print FixCode(DISPATCH_TO_METHOD_TEMPLATE % args) - print FixCode(DISPATCH_TO_FUNCTION_TEMPLATE % args) - - -def GenerateCreateFunctor(prebound, calltime): - print "// %d - %d" % (prebound, calltime) - args = { - "calltime": GenTuple("A%", calltime), - "prebound": GenTuple("P%", prebound), - "params": Merge([Gen("X%", prebound, 1), Gen("A%", calltime, 1)]), - "args": Gen("const P%& p%", prebound, 1), - "call_args": Gen("p%", prebound, 1), - "template_params": Merge([Gen("typename P%", prebound, 1), - Gen("typename A%", calltime, 1), - Gen("typename X%", prebound, 1)]) - } - - mutant = FixCode(CREATE_METHOD_FUNCTOR_TEMPLATE % args) - print mutant - - # Slightly different version for free function call. - print "\n", FixCode(CREATE_FUNCTION_FUNCTOR_TEMPLATE % args) - - # Functor with pointer to a pointer of the object. - print "\n#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" - mutant2 = mutant.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") - mutant2 = mutant2.replace("new Mutant", "new MutantLateObjectBind") - mutant2 = mutant2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") - print mutant2 - print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING\n" - - # OS_WIN specific. Same functors but with stdcall calling conventions. - # These are not for WIN64 (x86_64) because there is only one calling - # convention in WIN64. - # Functor for method with __stdcall calling conventions. - print "#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64)" - stdcall_method = CREATE_METHOD_FUNCTOR_TEMPLATE - stdcall_method = stdcall_method.replace("U::", "__stdcall U::") - stdcall_method = FixCode(stdcall_method % args) - print stdcall_method - # Functor for free function with __stdcall calling conventions. - stdcall_function = CREATE_FUNCTION_FUNCTOR_TEMPLATE - stdcall_function = stdcall_function.replace("R (*", "R (__stdcall *") - print "\n", FixCode(stdcall_function % args) - - print "#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" - stdcall2 = stdcall_method - stdcall2 = stdcall2.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") - stdcall2 = stdcall2.replace("new Mutant", "new MutantLateObjectBind") - stdcall2 = stdcall2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") - print stdcall2 - print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" - print "#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64)\n" - - -def main(): - print HEADER - for prebound in xrange(0, 6 + 1): - for args in xrange(0, 6 + 1): - GenerateDispatch(prebound, args) - print MUTANT - for prebound in xrange(0, 6 + 1): - for args in xrange(0, 6 + 1): - GenerateCreateFunctor(prebound, args) - print FOOTER - return 0 - - -if __name__ == "__main__": - sys.exit(main())
diff --git a/testing/gmock_mutant.h b/testing/gmock_mutant.h index f849119..961673f 100644 --- a/testing/gmock_mutant.h +++ b/testing/gmock_mutant.h
@@ -2,32 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This file automatically generated by testing/generate_gmock_mutant.py. -// DO NOT EDIT. - #ifndef TESTING_GMOCK_MUTANT_H_ #define TESTING_GMOCK_MUTANT_H_ // The intention of this file is to make possible using GMock actions in -// all of its syntactic beauty. Classes and helper functions can be used as -// more generic variants of Task and Callback classes (see base/task.h) -// Mutant supports both pre-bound arguments (like Task) and call-time -// arguments (like Callback) - hence the name. :-) -// -// DispatchToMethod/Function supports two sets of arguments: pre-bound (P) and -// call-time (C). The arguments as well as the return type are templatized. -// DispatchToMethod/Function will also try to call the selected method or -// function even if provided pre-bound arguments does not match exactly with -// the function signature hence the X1, X2 ... XN parameters in CreateFunctor. -// DispatchToMethod will try to invoke method that may not belong to the -// object's class itself but to the object's class base class. -// -// Additionally you can bind the object at calltime by binding a pointer to -// pointer to the object at creation time - before including this file you -// have to #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING. -// -// TODO(stoyan): It's yet not clear to me should we use T& and T&* instead -// of T* and T** when we invoke CreateFunctor to match the EXPECT_CALL style. +// all of its syntactic beauty. // // // Sample usage with gMock: @@ -60,15 +39,16 @@ // // arguments - they are not known until the OnRequest mock is invoked. // EXPECT_CALL(mock, OnRequest(Ge(5), base::StartsWith("flower")) // .Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, -// string("orchids")))); +// .WillOnce(Invoke(CreateFunctor( +// &Mock::HandleFlowers, base::Unretained(&mock), string("orchids")))); // // // // No pre-bound arguments, two call-time arguments passed // // directly to DoLogMessage // EXPECT_CALL(mock, OnLogMessage(_, _)) // .Times(AnyNumber()) -// .WillAlways(Invoke(CreateFunctor, &mock, &Mock::DoLogMessage)); +// .WillAlways(Invoke(CreateFunctor( +// &Mock::DoLogMessage, base::Unretained(&mock)))); // // // // In this case we have a single pre-bound argument - 3. We ignore @@ -76,7 +56,7 @@ // EXCEPT_CALL(mock, OnQuit(_)) // .Times(1) // .WillOnce(InvokeWithoutArgs(CreateFunctor( -// &mock, &Mock::QuitMessageLoop, 3))); +// &Mock::QuitMessageLoop, base::Unretained(&mock), 3))); // // MessageLoop loop; // loop.Run(); @@ -96,5082 +76,48 @@ // } // // EXPECT_CALL(mock, DemiurgeCreated(_)).Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::StoreDemiurge))); +// .WillOnce(Invoke(CreateFunctor( +// &Mock::StoreDemiurge, base::Unretained(&mock)))); // // EXPECT_CALL(mock, OnRequest(_, StrEq("Moby Dick"))) // .Times(AnyNumber()) -// .WillAlways(WithArgs<0>(Invoke( -// CreateFunctor(&mock->demiurge_, &Demiurge::DecreaseMonsters)))); +// .WillAlways(WithArgs<0>(Invoke(CreateFunctor( +// &Demiurge::DecreaseMonsters, base::Unretained(&mock->demiurge_))))); // -#include "base/memory/linked_ptr.h" -#include "base/tuple.h" +#include "base/bind.h" namespace testing { -// 0 - 0 -template <typename R, typename T, typename Method> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<>& c) { - return (obj->*method)(); -} -template <typename R, typename Function> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<>& c) { - return (*function)(); -} +template <typename Signature> +class CallbackToFunctorHelper; -// 0 - 1 -template <typename R, typename T, typename Method, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(c)); -} -template <typename R, typename Function, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(c)); -} - -// 0 - 2 -template <typename R, typename T, typename Method, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(c), base::get<1>(c)); -} - -// 0 - 3 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} - -// 0 - 4 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3, - typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} - -// 0 - 5 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3, - typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} - -// 0 - 6 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3, - typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 1 - 0 -template <typename R, typename T, typename Method, typename P1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p)); -} -template <typename R, typename Function, typename P1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p)); -} - -// 1 - 1 -template <typename R, typename T, typename Method, typename P1, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<0>(c)); -} - -// 1 - 2 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c)); -} - -// 1 - 3 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} - -// 1 - 4 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} - -// 1 - 5 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 1 - 6 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 2 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p)); -} -template <typename R, typename Function, typename P1, typename P2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p)); -} - -// 2 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c)); -} - -// 2 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c)); -} - -// 2 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} - -// 2 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} - -// 2 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 2 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3, typename C4, typename C5, - typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3, typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} - -// 3 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p)); -} - -// 3 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c)); -} - -// 3 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c)); -} - -// 3 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} - -// 3 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} - -// 3 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3, typename C4, - typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c)); -} - -// 3 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3, typename C4, - typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3, typename C4, typename C5, - typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c), base::get<5>(c)); -} - -// 4 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p)); -} - -// 4 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c)); -} - -// 4 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c)); -} - -// 4 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} - -// 4 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3, - typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} - -// 4 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3, - typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3, typename C4, - typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} - -// 4 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3, - typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3, typename C4, - typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 5 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p)); -} - -// 5 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c)); -} - -// 5 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c)); -} - -// 5 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} - -// 5 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3, - typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} - -// 5 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3, - typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 5 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3, - typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 6 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p)); -} - -// 6 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c)); -} - -// 6 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c)); -} - -// 6 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} - -// 6 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} - -// 6 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 6 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} - -// Interface that is exposed to the consumer, that does the actual calling -// of the method. -template <typename R, typename Params> -class MutantRunner { +template <typename R, typename... Args> +class CallbackToFunctorHelper<R(Args...)> { public: - virtual R RunWithParams(const Params& params) = 0; - virtual ~MutantRunner() {} -}; + explicit CallbackToFunctorHelper(const base::Callback<R(Args...)>& cb) + : cb_(cb) {} -// Mutant holds pre-bound arguments (like Task). Like Callback -// allows call-time arguments. You bind a pointer to the object -// at creation time. -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class Mutant : public MutantRunner<R, Params> { - public: - Mutant(T* obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToMethod<R>(this->obj_, this->method_, pb_, params); - } - - T* obj_; - Method method_; - PreBound pb_; -}; - -template <typename R, typename Function, typename PreBound, typename Params> -class MutantFunction : public MutantRunner<R, Params> { - public: - MutantFunction(Function function, const PreBound& pb) - : function_(function), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToFunction<R>(function_, pb_, params); - } - - Function function_; - PreBound pb_; -}; - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -// MutantLateBind is like Mutant, but you bind a pointer to a pointer -// to the object. This way you can create actions for an object -// that is not yet created (has only storage for a pointer to it). -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class MutantLateObjectBind : public MutantRunner<R, Params> { - public: - MutantLateObjectBind(T** obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation. - virtual R RunWithParams(const Params& params) { - EXPECT_THAT(*this->obj_, testing::NotNull()); - if (NULL == *this->obj_) - return R(); - return DispatchToMethod<R>( *this->obj_, this->method_, pb_, params); - } - - T** obj_; - Method method_; - PreBound pb_; -}; -#endif - -// Simple MutantRunner<> wrapper acting as a functor. -// Redirects operator() to MutantRunner<Params>::Run() -template <typename R, typename Params> -struct MutantFunctor { - explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) { - } - - ~MutantFunctor() { - } - - inline R operator()() { - return impl_->RunWithParams(base::Tuple<>()); - } - - template <typename Arg1> - inline R operator()(const Arg1& a) { - return impl_->RunWithParams(Params(a)); - } - - template <typename Arg1, typename Arg2> - inline R operator()(const Arg1& a, const Arg2& b) { - return impl_->RunWithParams(Params(a, b)); - } - - template <typename Arg1, typename Arg2, typename Arg3> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c) { - return impl_->RunWithParams(Params(a, b, c)); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c, - const Arg4& d) { - return impl_->RunWithParams(Params(a, b, c, d)); + template <typename... RunArgs> + R operator()(RunArgs&&... args) { + return cb_.Run(std::forward<RunArgs>(args)...); } private: - // We need copy constructor since MutantFunctor is copied few times - // inside GMock machinery, hence no DISALLOW_EVIL_CONTRUCTORS - MutantFunctor(); - linked_ptr<MutantRunner<R, Params> > impl_; + base::Callback<R(Args...)> cb_; }; -// 0 - 0 -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); +template <typename Signature> +CallbackToFunctorHelper<Signature> +CallbackToFunctor(const base::Callback<Signature>& cb) { + return CallbackToFunctorHelper<Signature>(cb); } -template <typename R> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(), - base::Tuple<>, base::Tuple<>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(), - base::Tuple<>, base::Tuple<>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 1 -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(A1), - base::Tuple<>, base::Tuple<A1>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(A1), - base::Tuple<>, base::Tuple<A1>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 2 -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 3 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename A1, typename A2, typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename A1, typename A2, typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 4 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 5 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 6 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 0 -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1), - base::Tuple<P1>, base::Tuple<>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1), - base::Tuple<P1>, base::Tuple<>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 1 -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename A1, typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename A1, typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 2 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 3 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 4 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 5 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 6 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, A1, A2, A3, A4, A5, A6), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, A1, A2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4, A5, A6), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, A1), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4, A5, A6), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3, X4), const P1& p1, const P2& p2, - const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1), const P1& p1, const P2& p2, - const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2), const P1& p1, const P2& p2, - const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5), const P1& p1, const P2& p2, - const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1), const P1& p1, const P2& p2, - const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6), const P1& p1, const P2& p2, - const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); +template <typename Functor, typename... BoundArgs> +CallbackToFunctorHelper<base::MakeUnboundRunType<Functor, BoundArgs...>> +CreateFunctor(Functor functor, const BoundArgs&... args) { + return CallbackToFunctor(base::Bind(functor, args...)); } -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) } // namespace testing
diff --git a/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event-expected.txt index eaa0784..dddf743 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event-expected.txt
@@ -8,6 +8,12 @@ d e f +Test for https://code.google.com/p/chromium/issues/detail?id=556677. + +For manual testing, focus a radio button in the first group and use the arrow keys. Changing the radio button should fire change events in the direction of left to right. + +x y z + b dispatched change event c dispatched change event PASS: a is not checked @@ -16,4 +22,12 @@ PASS: d is checked PASS: e is not checked PASS: f is not checked +z dispatched change event +y dispatched change event +PASS: x is not checked +PASS: y is checked +PASS: z is not checked +PASS: x is not checked +PASS: y is checked +PASS: z is not checked
diff --git a/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event.html b/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event.html index 1ae468f..d88c914 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event.html +++ b/third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event.html
@@ -20,6 +20,17 @@ <input type=radio name=bbb value=e onchange="handleChange(event)" onclick="handleClick(event)">e <input type=radio name=bbb value=f onchange="handleChange(event)" onclick="handleClick(event)">f +<p>Test for <a href="https://code.google.com/p/chromium/issues/detail?id=556677">https://code.google.com/p/chromium/issues/detail?id=556677</a>. + +<p>For manual testing, focus a radio button in the first group and use the arrow keys. Changing the +radio button should fire change events in the direction of left to right. + +<div dir="rtl"> +<p> +<input type=radio name=ccc value=x onchange="handleChange(event)"><span dir="rtl">x</span> +<input type=radio name=ccc value=y onchange="handleChange(event)"><span dir="rtl">y</span> +<input type=radio name=ccc value=z onchange="handleChange(event)"><span dir="rtl">z</span> +</div> <pre id=out></pre> <script> @@ -92,6 +103,23 @@ assertChecked('d'); assertNotChecked('e'); assertNotChecked('f'); + + getRadio('x').focus(); + eventSender.keyDown('rightArrow'); + eventSender.keyDown('rightArrow'); + + assertNotChecked('x'); + assertChecked('y'); + assertNotChecked('z'); + + getRadio('x').focus(); + eventSender.keyDown('downArrow'); + + assertNotChecked('x'); + assertChecked('y'); + assertNotChecked('z'); + + } </script>
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-basic.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-basic.html index ad320eb..852b5471 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-basic.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-basic.html
@@ -29,33 +29,44 @@ }, "Empty constructor behaves correctly."); test(function() { - var deltaX = 12.5; - var deltaY = 14.9; - var deltaGranularity = 148.3; - var velocityX = 23.7; - var velocityY = 2.5; - var inInertialPhase = true; - var isBeginning = true; - var isEnding = true; - var scrollState = new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, - velocityY, inInertialPhase, isBeginning, isEnding); - assert_equals(scrollState.deltaX, deltaX); - assert_equals(scrollState.deltaY, deltaY); - assert_equals(scrollState.deltaGranularity, deltaGranularity); - assert_equals(scrollState.velocityX, velocityX); - assert_equals(scrollState.velocityY, velocityY); - assert_equals(scrollState.inInertialPhase, inInertialPhase); - assert_equals(scrollState.isBeginning, isBeginning); - assert_equals(scrollState.isEnding, isEnding); - assert_equals(scrollState.fromUserInput, false); - assert_equals(scrollState.shouldPropagate, true); + var init = { + deltaX: 12.5, + deltaY: 14.9, + startPositionX: 16.82, + startPositionY: 82.17, + velocityX: 23.7, + velocityY: 2.5, + isBeginning: true, + isInInertialPhase: true, + isEnding: true, + shouldPropagate: false, + fromUserInput: true, + isDirectManipulation: true, + deltaGranularity: 148.3 + }; + var scrollState = new ScrollState(init); + assert_equals(scrollState.deltaX, init.deltaX); + assert_equals(scrollState.deltaY, init.deltaY); + assert_equals(scrollState.startPositionX, Math.floor(init.startPositionX)); + assert_equals(scrollState.startPositionY, Math.floor(init.startPositionY)); + assert_equals(scrollState.velocityX, init.velocityX); + assert_equals(scrollState.velocityY, init.velocityY); + assert_equals(scrollState.isBeginning, init.isBeginning); + assert_equals(scrollState.inInertialPhase, init.isInInertialPhase); + assert_equals(scrollState.isEnding, init.isEnding); + assert_equals(scrollState.shouldPropagate, init.shouldPropagate); + assert_equals(scrollState.fromUserInput, init.fromUserInput); + assert_equals(scrollState.isDirectManipulation, init.isDirectManipulation); + assert_equals(scrollState.deltaGranularity, init.deltaGranularity); }, "Constructor behaves correctly."); test(function() { var scrollState = new ScrollState(); + scrollState.isBeginning = true; + assert_equals(scrollState.isBeginning, false); scrollState.fromUserInput = true; assert_equals(scrollState.fromUserInput, false); - }, "fromUserInput is read only"); + }, "attributes are read only"); } </script> </body>
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html index 5345dde1..7ac4c51 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html
@@ -14,7 +14,7 @@ function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedError) { test(function() { - var scrollState = new ScrollState(dx, dy); + var scrollState = new ScrollState({deltaX: dx, deltaY: dy}); assert_throws('InvalidModificationError', function() { scrollState.consumeDelta(consume_x, consume_y); });
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html index f37b597e..5120022 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html
@@ -20,7 +20,7 @@ }, "These tests only work with scroll customization enabled."); if ('ScrollState' in window) { - var scrollState = new ScrollState(10, -20); + var scrollState = new ScrollState({deltaX: 10, deltaY: -20}); deltaShouldBe(scrollState, 10, -20, "Unconsumed deltas"); scrollState.consumeDelta(2, -3); deltaShouldBe(scrollState, 8, -17, "Partially consumed deltas");
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html index c1f726fa..588c2ac4 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html
@@ -33,7 +33,7 @@ if ('ScrollState' in window && window.internals) { test(function() { - var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false); + var scrollState = new ScrollState({deltaX: 100}); window.internals.setScrollChain(scrollState, elements); scrollState.distributeToScrollChainDescendant(); assert_equals(0, remainingNumberOfTimesToBeCalled); @@ -43,7 +43,7 @@ }, "distributeToScrollChainDescendant propagates correctly."); test(function() { - var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false); + var scrollState = new ScrollState({deltaX: 100}); window.internals.setScrollChain(scrollState, []); assert_equals(0, remainingNumberOfTimesToBeCalled); scrollState.distributeToScrollChainDescendant();
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html index 445c66f..0bd2bf2 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html
@@ -189,7 +189,7 @@ assert_equals(elements[i].numberOfScrollBegins, deltas.length, "Incorrect number of begin events for " + elements[i].id); assert_equals(elements[i].numberOfScrollEnds, deltas.length, "Incorrect number of end events for " + elements[i].id); } - }, "Correct number of scroll end and begin events observed."); + }, "Correct number of scroll begin and end events observed."); { // NOTE - this async test needs to be run last, as it shares state with the
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html index 17344528..e20895699d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html +++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html
@@ -52,12 +52,15 @@ // Deliberately add more actions than are supported. for (var i = 0; i < 2 * Notification.maxActions; i++) { options.actions.push({ - action: "a" + i, - title: "Action " + i + action: 'a' + i, + title: 'Action ' + i, + icon: 'https://example/action_icon_' + i + '.png' }); } - testRunner.setPermission('notifications', 'granted', location.origin, location.origin); + if (window.testRunner) { + testRunner.setPermission('notifications', 'granted', location.origin, location.origin); + } getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(workerInfo) { // (1) Tell the Service Worker to display a Web Notification. workerInfo.port.postMessage({ @@ -80,7 +83,9 @@ // notification's display promise has been resolved. if (event.data.command == 'show') { assert_true(event.data.success, 'The notification must have been displayed.'); - testRunner.simulateWebNotificationClick(scope, -1 /* action_index */); + if (window.testRunner) { + testRunner.simulateWebNotificationClick(scope, -1 /* action_index */); + } return; } @@ -96,11 +101,11 @@ assert_equals(notifications.length, 1); assert_object_is_superset(notifications[0], options, 'The Notification object properties must be the same in getNotifications.'); - notifications[0].actions.foo = "bar"; - notifications[0].actions.push({ title: "Foo" }); + notifications[0].actions.foo = 'bar'; + notifications[0].actions.push({ title: 'Foo' }); if (notifications[0].actions.length) { - notifications[0].actions[0].title = "Changed"; - notifications[0].actions[0].foo = "bar"; + notifications[0].actions[0].title = 'Changed'; + notifications[0].actions[0].foo = 'bar'; } assert_object_equals(notifications[0].actions, options.actions, 'The actions field should be immutable.');
diff --git a/third_party/WebKit/Source/bindings/templates/dictionary_v8.h b/third_party/WebKit/Source/bindings/templates/dictionary_v8.h index 7eb47ad..e9bc6dc16 100644 --- a/third_party/WebKit/Source/bindings/templates/dictionary_v8.h +++ b/third_party/WebKit/Source/bindings/templates/dictionary_v8.h
@@ -29,6 +29,11 @@ static {{cpp_class}} nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&); }; +template <> +struct V8TypeOf<{{cpp_class}}> { + typedef {{v8_class}} Type; +}; + } // namespace blink #endif // {{v8_original_class}}_h
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.h b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.h index 143d66d..631ee49d 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.h +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.h
@@ -36,6 +36,11 @@ static TestDictionary nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&); }; +template <> +struct V8TypeOf<TestDictionary> { + typedef V8TestDictionary Type; +}; + } // namespace blink #endif // V8TestDictionary_h
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.h b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.h index d9e2bf8..0619a6d 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.h +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.h
@@ -36,6 +36,11 @@ static TestDictionaryDerivedImplementedAs nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&); }; +template <> +struct V8TypeOf<TestDictionaryDerivedImplementedAs> { + typedef V8TestDictionaryDerivedImplementedAs Type; +}; + } // namespace blink #endif // V8TestDictionaryDerived_h
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.h b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.h index 189e76d6..5b18bf1 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.h +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInit.h
@@ -36,6 +36,11 @@ static TestInterfaceEventInit nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&); }; +template <> +struct V8TypeOf<TestInterfaceEventInit> { + typedef V8TestInterfaceEventInit Type; +}; + } // namespace blink #endif // V8TestInterfaceEventInit_h
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestPermissiveDictionary.h b/third_party/WebKit/Source/bindings/tests/results/core/V8TestPermissiveDictionary.h index 1a2566f..9346dc2a 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestPermissiveDictionary.h +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestPermissiveDictionary.h
@@ -36,6 +36,11 @@ static TestPermissiveDictionary nativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&); }; +template <> +struct V8TypeOf<TestPermissiveDictionary> { + typedef V8TestPermissiveDictionary Type; +}; + } // namespace blink #endif // V8TestPermissiveDictionary_h
diff --git a/third_party/WebKit/Source/core/core.gyp b/third_party/WebKit/Source/core/core.gyp index 28361dc..ef668da 100644 --- a/third_party/WebKit/Source/core/core.gyp +++ b/third_party/WebKit/Source/core/core.gyp
@@ -662,6 +662,7 @@ '../wtf/wtf.gyp:wtf', '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/gin/gin.gyp:gin', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/libxml/libxml.gyp:libxml',
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi index 983a43ee..4eab91e 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi
@@ -2305,11 +2305,11 @@ 'xml/parser/XMLErrors.cpp', 'xml/parser/XMLErrors.h', 'xml/parser/XMLParserInput.h', + 'xmlhttprequest/ProgressEventThrottle.cpp', + 'xmlhttprequest/ProgressEventThrottle.h', 'xmlhttprequest/XMLHttpRequest.cpp', 'xmlhttprequest/XMLHttpRequest.h', 'xmlhttprequest/XMLHttpRequestEventTarget.h', - 'xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp', - 'xmlhttprequest/XMLHttpRequestProgressEventThrottle.h', 'xmlhttprequest/XMLHttpRequestUpload.cpp', 'xmlhttprequest/XMLHttpRequestUpload.h', ], @@ -3675,6 +3675,7 @@ 'imagebitmap/ImageBitmapOptions.idl', 'input/InputDeviceCapabilitiesInit.idl', 'page/EventSourceInit.idl', + 'page/scrolling/ScrollStateInit.idl', 'timing/PerformanceObserverInit.idl', ], 'generated_core_dictionary_files': [ @@ -3780,6 +3781,8 @@ '<(blink_core_output_dir)/input/InputDeviceCapabilitiesInit.h', '<(blink_core_output_dir)/page/EventSourceInit.cpp', '<(blink_core_output_dir)/page/EventSourceInit.h', + '<(blink_core_output_dir)/page/scrolling/ScrollStateInit.cpp', + '<(blink_core_output_dir)/page/scrolling/ScrollStateInit.h', '<(blink_core_output_dir)/timing/PerformanceObserverInit.cpp', '<(blink_core_output_dir)/timing/PerformanceObserverInit.h', ],
diff --git a/third_party/WebKit/Source/core/frame/Settings.in b/third_party/WebKit/Source/core/frame/Settings.in index c62afe0..f622dfa 100644 --- a/third_party/WebKit/Source/core/frame/Settings.in +++ b/third_party/WebKit/Source/core/frame/Settings.in
@@ -103,6 +103,8 @@ mediaControlsOverlayPlayButtonEnabled initial=false mediaPlaybackRequiresUserGesture initial=false +presentationRequiresUserGesture initial=true + scrollAnimatorEnabled initial=true # Used to disable threaded, compositor scrolling for testing purposes.
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index ac9168d..41da0b6d 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -326,7 +326,6 @@ , m_completelyLoaded(false) , m_havePreparedToPlay(false) , m_tracksAreReady(true) - , m_haveVisibleTextTrack(false) , m_processingPreferenceChange(false) , m_remoteRoutesAvailable(false) , m_playingRemotely(false) @@ -3365,10 +3364,10 @@ if (m_processingPreferenceChange) return; - m_haveVisibleTextTrack = m_textTracks->hasShowingTracks(); - m_closedCaptionsVisible = m_haveVisibleTextTrack; + bool haveVisibleTextTrack = m_textTracks->hasShowingTracks(); + m_closedCaptionsVisible = haveVisibleTextTrack; - if (!m_haveVisibleTextTrack && !mediaControls()) + if (!haveVisibleTextTrack && !mediaControls()) return; if (mediaControls())
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h index 0b731fbb..a3decbe 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -539,7 +539,6 @@ bool m_delayingLoadForPreloadNone : 1; bool m_tracksAreReady : 1; - bool m_haveVisibleTextTrack : 1; bool m_processingPreferenceChange : 1; bool m_remoteRoutesAvailable : 1; bool m_playingRemotely : 1;
diff --git a/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp b/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp index eca599d..2aa6c96 100644 --- a/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp
@@ -101,7 +101,7 @@ Document& document = element().document(); if (isSpatialNavigationEnabled(document.frame())) return; - bool forward = (key == "Down" || key == "Right"); + bool forward = computedTextDirection() == RTL ? (key == "Down" || key == "Left") : (key == "Down" || key == "Right"); // We can only stay within the form's children if the form hasn't been demoted to a leaf because // of malformed HTML.
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index 762216c4..13b2304 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -2445,9 +2445,13 @@ if (node) { passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { - RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( - 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ - false, /* isEnding */ true, /* fromUserInput */ true); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + scrollStateData->is_ending = true; + scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); + scrollStateData->from_user_input = true; + scrollStateData->is_direct_manipulation = true; + scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedForScrollSequence; + RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(scrollStateData.release()); customizedScroll(*node.get(), *scrollState); } } @@ -2482,9 +2486,13 @@ passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->layoutObject()); if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { m_currentScrollChain.clear(); - RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( - 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ - true, /* isEnding */ false, /* fromUserInput */ true); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + scrollStateData->start_position_x = gestureEvent.position().x(); + scrollStateData->start_position_y = gestureEvent.position().y(); + scrollStateData->is_beginning = true; + scrollStateData->from_user_input = true; + scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedForScrollSequence; + RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(scrollStateData.release()); customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); } else { if (m_frame->isMainFrame()) @@ -2561,12 +2569,16 @@ bool scrolled = false; if (handleScrollCustomization) { - RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( - gestureEvent.deltaX(), gestureEvent.deltaY(), - 0, gestureEvent.velocityX(), gestureEvent.velocityY(), - gestureEvent.inertial(), /* isBeginning */ - false, /* isEnding */ false, /* fromUserInput */ true, - !gestureEvent.preventPropagation(), m_deltaConsumedForScrollSequence); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + scrollStateData->delta_x = gestureEvent.deltaX(); + scrollStateData->delta_y = gestureEvent.deltaY(); + scrollStateData->velocity_x = gestureEvent.velocityX(); + scrollStateData->velocity_y = gestureEvent.velocityY(); + scrollStateData->should_propagate = !gestureEvent.preventPropagation(); + scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); + scrollStateData->from_user_input = true; + scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedForScrollSequence; + RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(scrollStateData.release()); if (m_previousGestureScrolledNode) { // The ScrollState needs to know what the current // native scrolling element is, so that for an
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp index b462fd9..bdba1458 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp
@@ -24,37 +24,44 @@ } } // namespace -PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create( - double deltaX, double deltaY, double deltaGranularity, double velocityX, - double velocityY, bool inInertialPhase, - bool isBeginning, bool isEnding, - bool fromUserInput, bool shouldPropagate, - bool deltaConsumedForScrollSequence) +PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create(ScrollStateInit init) { - OwnPtr<WebScrollStateData> data(adoptPtr(new WebScrollStateData(deltaX, deltaY, deltaGranularity, velocityX, velocityY, - inInertialPhase, isBeginning, isEnding, fromUserInput, shouldPropagate, - deltaConsumedForScrollSequence))); - return adoptRefWillBeNoop(new ScrollState(data.release())); + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + scrollStateData->delta_x = init.deltaX(); + scrollStateData->delta_y = init.deltaY(); + scrollStateData->start_position_x = init.startPositionX(); + scrollStateData->start_position_y = init.startPositionY(); + scrollStateData->velocity_x = init.velocityX(); + scrollStateData->velocity_y = init.velocityY(); + scrollStateData->is_beginning = init.isBeginning(); + scrollStateData->is_in_inertial_phase = init.isInInertialPhase(); + scrollStateData->is_ending = init.isEnding(); + scrollStateData->should_propagate = init.shouldPropagate(); + scrollStateData->from_user_input = init.fromUserInput(); + scrollStateData->is_direct_manipulation = init.isDirectManipulation(); + scrollStateData->delta_granularity = init.deltaGranularity(); + ScrollState* scrollState = new ScrollState(scrollStateData.release()); + return adoptRefWillBeNoop(scrollState); } -PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create(PassOwnPtr<WebScrollStateData> data) +PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create(PassOwnPtr<ScrollStateData> data) { ScrollState* scrollState = new ScrollState(data); return adoptRefWillBeNoop(scrollState); } -ScrollState::ScrollState(PassOwnPtr<WebScrollStateData> data) +ScrollState::ScrollState(PassOwnPtr<ScrollStateData> data) : m_data(data) { } void ScrollState::consumeDelta(double x, double y, ExceptionState& exceptionState) { - if ((m_data->deltaX > 0 && 0 > x) || (m_data->deltaX < 0 && 0 < x) || (m_data->deltaY > 0 && 0 > y) || (m_data->deltaY < 0 && 0 < y)) { + if ((m_data->delta_x > 0 && 0 > x) || (m_data->delta_x < 0 && 0 < x) || (m_data->delta_y > 0 && 0 > y) || (m_data->delta_y < 0 && 0 < y)) { exceptionState.throwDOMException(InvalidModificationError, "Can't increase delta using consumeDelta"); return; } - if (fabs(x) > fabs(m_data->deltaX) || fabs(y) > fabs(m_data->deltaY)) { + if (fabs(x) > fabs(m_data->delta_x) || fabs(y) > fabs(m_data->delta_y)) { exceptionState.throwDOMException(InvalidModificationError, "Can't change direction of delta using consumeDelta"); return; } @@ -72,33 +79,33 @@ void ScrollState::consumeDeltaNative(double x, double y) { - m_data->deltaX -= x; - m_data->deltaY -= y; + m_data->delta_x -= x; + m_data->delta_y -= y; + if (x) + m_data->caused_scroll_x = true; + if (y) + m_data->caused_scroll_y = true; if (x || y) - m_data->deltaConsumedForScrollSequence = true; + m_data->delta_consumed_for_scroll_sequence = true; } Element* ScrollState::currentNativeScrollingElement() const { - if (m_data->currentNativeScrollingElement == 0) + uint64_t elementId = m_data->current_native_scrolling_element(); + if (elementId == 0) return nullptr; - return elementForId(m_data->currentNativeScrollingElement); + return elementForId(elementId); } void ScrollState::setCurrentNativeScrollingElement(Element* element) { - m_data->currentNativeScrollingElement = DOMNodeIds::idForNode(element); -} - -int ScrollState::currentNativeScrollingElementId() const -{ - return m_data->currentNativeScrollingElement; + m_data->set_current_native_scrolling_element(DOMNodeIds::idForNode(element)); } void ScrollState::setCurrentNativeScrollingElementById(int elementId) { - m_data->currentNativeScrollingElement = elementId; + m_data->set_current_native_scrolling_element(elementId); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h index 78425dd..d38e3cf 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h
@@ -9,7 +9,9 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "core/CoreExport.h" #include "core/dom/Element.h" -#include "public/platform/WebScrollStateData.h" +#include "core/page/scrolling/ScrollStateInit.h" +#include "platform/scroll/ScrollStateData.h" +#include <deque> namespace blink { @@ -17,14 +19,8 @@ DEFINE_WRAPPERTYPEINFO(); public: - static PassRefPtrWillBeRawPtr<ScrollState> create( - double deltaX, double deltaY, double deltaGranularity, double velocityX, - double velocityY, bool inInertialPhase, - bool isBeginning = false, bool isEnding = false, - bool fromUserInput = false, bool shouldPropagate = true, - bool deltaConsumedForScrollSequence = false); - - static PassRefPtrWillBeRawPtr<ScrollState> create(PassOwnPtr<WebScrollStateData>); + static PassRefPtrWillBeRawPtr<ScrollState> create(ScrollStateInit); + static PassRefPtrWillBeRawPtr<ScrollState> create(PassOwnPtr<ScrollStateData>); ~ScrollState() { @@ -36,26 +32,31 @@ void consumeDelta(double x, double y, ExceptionState&); // Pops the first element off of |m_scrollChain| and calls |distributeScroll| on it. void distributeToScrollChainDescendant(); + int startPositionX() { return m_data->start_position_x; }; + int startPositionY() { return m_data->start_position_y; }; // Positive when scrolling left. - double deltaX() const { return m_data->deltaX; }; + double deltaX() const { return m_data->delta_x; }; // Positive when scrolling up. - double deltaY() const { return m_data->deltaY; }; + double deltaY() const { return m_data->delta_y; }; // Indicates the smallest delta the input device can produce. 0 for unquantized inputs. - double deltaGranularity() const { return m_data->deltaGranularity; }; + double deltaGranularity() const { return m_data->delta_granularity; }; // Positive if moving right. - double velocityX() const { return m_data->velocityX; }; + double velocityX() const { return m_data->velocity_x; }; // Positive if moving down. - double velocityY() const { return m_data->velocityY; }; + double velocityY() const { return m_data->velocity_y; }; // True for events dispatched after the users's gesture has finished. - bool inInertialPhase() const { return m_data->inInertialPhase; }; + bool inInertialPhase() const { return m_data->is_in_inertial_phase; }; // True if this is the first event for this scroll. - bool isBeginning() const { return m_data->isBeginning; }; + bool isBeginning() const { return m_data->is_beginning; }; // True if this is the last event for this scroll. - bool isEnding() const { return m_data->isEnding; }; + bool isEnding() const { return m_data->is_ending; }; // True if this scroll is the direct result of user input. - bool fromUserInput() const { return m_data->fromUserInput; }; + bool fromUserInput() const { return m_data->from_user_input; }; + // True if this scroll is the result of the user interacting directly with + // the screen, e.g., via touch. + bool isDirectManipulation() const { return m_data->is_direct_manipulation; } // True if this scroll is allowed to bubble upwards. - bool shouldPropagate() const { return m_data->shouldPropagate; }; + bool shouldPropagate() const { return m_data->should_propagate; }; // Non web exposed methods. void consumeDeltaNative(double x, double y); @@ -69,47 +70,28 @@ Element* currentNativeScrollingElement() const; void setCurrentNativeScrollingElement(Element*); - int currentNativeScrollingElementId() const; void setCurrentNativeScrollingElementById(int elementId); bool deltaConsumedForScrollSequence() const { - return m_data->deltaConsumedForScrollSequence; + return m_data->delta_consumed_for_scroll_sequence; } // Scroll begin and end must propagate to all nodes to ensure // their state is updated. bool fullyConsumed() const { - return !m_data->deltaX && !m_data->deltaY && !m_data->isEnding && !m_data->isBeginning; + return !m_data->delta_x && !m_data->delta_y && !m_data->is_ending && !m_data->is_beginning; } - // These are only used for CompositorWorker scrolling, and should be gotten - // rid of eventually. - void setCausedScroll(bool x, bool y) - { - m_data->causedScrollX = x; - m_data->causedScrollY = y; - } - - bool causedScrollX() const - { - return m_data->causedScrollX; - } - - bool causedScrollY() const - { - return m_data->causedScrollY; - } - - WebScrollStateData* data() const { return m_data.get(); } + ScrollStateData* data() const { return m_data.get(); } DEFINE_INLINE_TRACE() {} private: ScrollState(); - ScrollState(PassOwnPtr<WebScrollStateData>); - PassOwnPtr<WebScrollStateData> m_data; + ScrollState(PassOwnPtr<ScrollStateData>); + PassOwnPtr<ScrollStateData> m_data; std::deque<int> m_scrollChain; };
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.idl b/third_party/WebKit/Source/core/page/scrolling/ScrollState.idl index 228d973..7e5ff50 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.idl +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.idl
@@ -5,27 +5,24 @@ // https://docs.google.com/document/d/1VnvAqeWFG9JFZfgG5evBqrLGDZYRE5w6G5jEDORekPY [ - Constructor(optional double deltaX = 0, - optional double deltaY = 0, - optional double deltaGranularity = 0, - optional double velocityX = 0, - optional double velocityY = 0, - optional boolean inInertialPhase = false, - optional boolean isBeginning = false, - optional boolean isEnding = false), - WillBeGarbageCollected, - RuntimeEnabled=ScrollCustomization -] interface ScrollState { + Constructor(optional ScrollStateInit scrollStateInit), + WillBeGarbageCollected, + RuntimeEnabled = ScrollCustomization, +] interface ScrollState +{ readonly attribute double deltaX; readonly attribute double deltaY; - readonly attribute double deltaGranularity; + readonly attribute long startPositionX; + readonly attribute long startPositionY; readonly attribute double velocityX; readonly attribute double velocityY; + readonly attribute boolean isBeginning; readonly attribute boolean inInertialPhase; readonly attribute boolean isEnding; - readonly attribute boolean isBeginning; - readonly attribute boolean fromUserInput; readonly attribute boolean shouldPropagate; + readonly attribute boolean fromUserInput; + readonly attribute boolean isDirectManipulation; + readonly attribute double deltaGranularity; [RaisesException] void consumeDelta(double x, double y); void distributeToScrollChainDescendant();
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollStateInit.idl b/third_party/WebKit/Source/core/page/scrolling/ScrollStateInit.idl new file mode 100644 index 0000000..d7aa140 --- /dev/null +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollStateInit.idl
@@ -0,0 +1,21 @@ +// Copyright 2016 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. + +// https://docs.google.com/document/d/1VnvAqeWFG9JFZfgG5evBqrLGDZYRE5w6G5jEDORekPY + +dictionary ScrollStateInit { + double deltaX = 0; + double deltaY = 0; + long startPositionX = 0; + long startPositionY = 0; + double velocityX = 0; + double velocityY = 0; + boolean isBeginning = false; + boolean isInInertialPhase = false; + boolean isEnding = false; + boolean shouldPropagate = true; + boolean fromUserInput = false; + boolean isDirectManipulation = false; + double deltaGranularity = 0; +};
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp index 6c7a1a9..c44546d 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
@@ -10,6 +10,18 @@ namespace blink { +namespace { + +PassRefPtrWillBeRawPtr<ScrollState> CreateScrollState(double deltaX, double deltaY, bool beginning, bool ending) +{ + OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + scrollStateData->delta_x = deltaX; + scrollStateData->delta_y = deltaY; + scrollStateData->is_beginning = beginning; + scrollStateData->is_ending = ending; + return ScrollState::create(scrollStateData.release()); +} + class ScrollStateTest : public testing::Test { }; @@ -21,7 +33,7 @@ const float deltaXToConsume = 1.2; const float deltaYToConsume = 2.3; - RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(deltaX, deltaY, 0, 0, 0, false, false); + RefPtrWillBeRawPtr<ScrollState> scrollState = CreateScrollState(deltaX, deltaY, false, false); EXPECT_FLOAT_EQ(deltaX, scrollState->deltaX()); EXPECT_FLOAT_EQ(deltaY, scrollState->deltaY()); EXPECT_FALSE(scrollState->deltaConsumedForScrollSequence()); @@ -52,8 +64,7 @@ TEST_F(ScrollStateTest, CurrentNativeScrollingElement) { - RefPtrWillBeRawPtr<ScrollState> scrollState = - ScrollState::create(0, 0, 0, 0, 0, false, false); + RefPtrWillBeRawPtr<ScrollState> scrollState = CreateScrollState(0, 0, false, false); RefPtrWillBeRawPtr<Element> element = Element::create( QualifiedName::null(), Document::create().get()); scrollState->setCurrentNativeScrollingElement(element.get()); @@ -63,15 +74,14 @@ TEST_F(ScrollStateTest, FullyConsumed) { - RefPtrWillBeRawPtr<ScrollState> scrollStateBegin = - ScrollState::create(0, 0, 0, 0, 0, false, true, false); - RefPtrWillBeRawPtr<ScrollState> scrollState = - ScrollState::create(0, 0, 0, 0, 0, false, false, false); - RefPtrWillBeRawPtr<ScrollState> scrollStateEnd = - ScrollState::create(0, 0, 0, 0, 0, false, false, true); + RefPtrWillBeRawPtr<ScrollState> scrollStateBegin = CreateScrollState(0, 0, true, false); + RefPtrWillBeRawPtr<ScrollState> scrollState = CreateScrollState(0, 0, false, false); + RefPtrWillBeRawPtr<ScrollState> scrollStateEnd = CreateScrollState(0, 0, false, true); EXPECT_FALSE(scrollStateBegin->fullyConsumed()); EXPECT_TRUE(scrollState->fullyConsumed()); EXPECT_FALSE(scrollStateEnd->fullyConsumed()); } +} // namespace + } // namespace blink
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp b/third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.cpp similarity index 79% rename from third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp rename to third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.cpp index 7d3d6b1..6247229 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.cpp
@@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" +#include "core/xmlhttprequest/ProgressEventThrottle.h" #include "core/EventTypeNames.h" #include "core/events/ProgressEvent.h" @@ -36,12 +36,12 @@ namespace blink { -XMLHttpRequestProgressEventThrottle::DeferredEvent::DeferredEvent() +ProgressEventThrottle::DeferredEvent::DeferredEvent() { clear(); } -void XMLHttpRequestProgressEventThrottle::DeferredEvent::set(bool lengthComputable, unsigned long long loaded, unsigned long long total) +void ProgressEventThrottle::DeferredEvent::set(bool lengthComputable, unsigned long long loaded, unsigned long long total) { m_isSet = true; @@ -50,7 +50,7 @@ m_total = total; } -void XMLHttpRequestProgressEventThrottle::DeferredEvent::clear() +void ProgressEventThrottle::DeferredEvent::clear() { m_isSet = false; @@ -59,7 +59,7 @@ m_total = 0; } -PassRefPtrWillBeRawPtr<Event> XMLHttpRequestProgressEventThrottle::DeferredEvent::take() +PassRefPtrWillBeRawPtr<Event> ProgressEventThrottle::DeferredEvent::take() { ASSERT(m_isSet); @@ -68,20 +68,20 @@ return event.release(); } -const double XMLHttpRequestProgressEventThrottle::minimumProgressEventDispatchingIntervalInSeconds = .05; // 50 ms per specification. +const double ProgressEventThrottle::minimumProgressEventDispatchingIntervalInSeconds = .05; // 50 ms per specification. -XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttpRequest* target) +ProgressEventThrottle::ProgressEventThrottle(XMLHttpRequest* target) : m_target(target) , m_hasDispatchedProgressProgressEvent(false) { ASSERT(target); } -XMLHttpRequestProgressEventThrottle::~XMLHttpRequestProgressEventThrottle() +ProgressEventThrottle::~ProgressEventThrottle() { } -void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total) +void ProgressEventThrottle::dispatchProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total) { // Given that ResourceDispatcher doesn't deliver an event when suspended, // we don't have to worry about event dispatching while suspended. @@ -98,7 +98,7 @@ } } -void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event> event, DeferredEventAction action) +void ProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event> event, DeferredEventAction action) { XMLHttpRequest::State state = m_target->readyState(); // Given that ResourceDispatcher doesn't deliver an event when suspended, @@ -123,7 +123,7 @@ } } -void XMLHttpRequestProgressEventThrottle::dispatchProgressProgressEvent(PassRefPtrWillBeRawPtr<Event> progressEvent) +void ProgressEventThrottle::dispatchProgressProgressEvent(PassRefPtrWillBeRawPtr<Event> progressEvent) { XMLHttpRequest::State state = m_target->readyState(); if (m_target->readyState() == XMLHttpRequest::LOADING && m_hasDispatchedProgressProgressEvent) { @@ -139,7 +139,7 @@ m_target->dispatchEvent(progressEvent); } -void XMLHttpRequestProgressEventThrottle::fired() +void ProgressEventThrottle::fired() { if (!m_deferred.isSet()) { // No "progress" event was queued since the previous dispatch, we can @@ -153,12 +153,12 @@ startOneShot(minimumProgressEventDispatchingIntervalInSeconds, BLINK_FROM_HERE); } -void XMLHttpRequestProgressEventThrottle::suspend() +void ProgressEventThrottle::suspend() { stop(); } -void XMLHttpRequestProgressEventThrottle::resume() +void ProgressEventThrottle::resume() { if (!m_deferred.isSet()) return; @@ -169,7 +169,7 @@ startOneShot(0, BLINK_FROM_HERE); } -DEFINE_TRACE(XMLHttpRequestProgressEventThrottle) +DEFINE_TRACE(ProgressEventThrottle) { visitor->trace(m_target); }
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h b/third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.h similarity index 88% rename from third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h rename to third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.h index edfaa606..8badaa5 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h +++ b/third_party/WebKit/Source/core/xmlhttprequest/ProgressEventThrottle.h
@@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef XMLHttpRequestProgressEventThrottle_h -#define XMLHttpRequestProgressEventThrottle_h +#ifndef ProgressEventThrottle_h +#define ProgressEventThrottle_h #include "platform/Timer.h" #include "platform/heap/Handle.h" @@ -48,13 +48,13 @@ // - "progress" event means an event named "progress" // - ProgressEvent means an event using the ProgressEvent interface defined in // the spec. -class XMLHttpRequestProgressEventThrottle final : public GarbageCollectedFinalized<XMLHttpRequestProgressEventThrottle>, public TimerBase { +class ProgressEventThrottle final : public GarbageCollectedFinalized<ProgressEventThrottle>, public TimerBase { public: - static XMLHttpRequestProgressEventThrottle* create(XMLHttpRequest* eventTarget) + static ProgressEventThrottle* create(XMLHttpRequest* eventTarget) { - return new XMLHttpRequestProgressEventThrottle(eventTarget); + return new ProgressEventThrottle(eventTarget); } - ~XMLHttpRequestProgressEventThrottle() override; + ~ProgressEventThrottle() override; enum DeferredEventAction { Ignore, @@ -85,7 +85,7 @@ DECLARE_TRACE(); private: - explicit XMLHttpRequestProgressEventThrottle(XMLHttpRequest*); + explicit ProgressEventThrottle(XMLHttpRequest*); // Dispatches a "progress" progress event and usually a readyStateChange // event as well. @@ -127,4 +127,4 @@ } // namespace blink -#endif // XMLHttpRequestProgressEventThrottle_h +#endif // ProgressEventThrottle_h
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp index d52c89cb..e8d7548 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -208,7 +208,7 @@ , m_lengthDownloadedToFile(0) , m_receivedLength(0) , m_exceptionCode(0) - , m_progressEventThrottle(XMLHttpRequestProgressEventThrottle::create(this)) + , m_progressEventThrottle(ProgressEventThrottle::create(this)) , m_responseTypeCode(ResponseTypeDefault) , m_isolatedWorldSecurityOrigin(isolatedWorldSecurityOrigin) , m_eventDispatchRecursionLevel(0) @@ -506,12 +506,12 @@ ScopedEventDispatchProtect protect(&m_eventDispatchRecursionLevel); if (m_async || (m_state <= OPENED || m_state == DONE)) { TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", InspectorXhrReadyStateChangeEvent::data(executionContext(), this)); - XMLHttpRequestProgressEventThrottle::DeferredEventAction action = XMLHttpRequestProgressEventThrottle::Ignore; + ProgressEventThrottle::DeferredEventAction action = ProgressEventThrottle::Ignore; if (m_state == DONE) { if (m_error) - action = XMLHttpRequestProgressEventThrottle::Clear; + action = ProgressEventThrottle::Clear; else - action = XMLHttpRequestProgressEventThrottle::Flush; + action = ProgressEventThrottle::Flush; } m_progressEventThrottle->dispatchReadyStateChangeEvent(Event::create(EventTypeNames::readystatechange), action); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h index 60c51e5..103c813 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
@@ -27,8 +27,8 @@ #include "core/dom/ActiveDOMObject.h" #include "core/dom/DocumentParserClient.h" #include "core/loader/ThreadableLoaderClient.h" +#include "core/xmlhttprequest/ProgressEventThrottle.h" #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" -#include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" #include "platform/heap/Handle.h" #include "platform/network/EncodedFormData.h" #include "platform/network/HTTPHeaderMap.h" @@ -250,7 +250,7 @@ void handleRequestError(ExceptionCode, const AtomicString&, long long, long long); - XMLHttpRequestProgressEventThrottle& progressEventThrottle(); + ProgressEventThrottle& progressEventThrottle(); Member<XMLHttpRequestUpload> m_upload; @@ -289,7 +289,7 @@ // any. ExceptionCode m_exceptionCode; - Member<XMLHttpRequestProgressEventThrottle> m_progressEventThrottle; + Member<ProgressEventThrottle> m_progressEventThrottle; // An enum corresponding to the allowed string values for the responseType attribute. ResponseTypeCode m_responseTypeCode;
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp index be2c4e2..d24f88e3 100644 --- a/third_party/WebKit/Source/modules/notifications/Notification.cpp +++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
@@ -293,6 +293,7 @@ for (size_t i = 0; i < m_data.actions.size(); ++i) { actions[i].setAction(m_data.actions[i].action); actions[i].setTitle(m_data.actions[i].title); + actions[i].setIcon(m_data.actions[i].icon.string()); } return actions;
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationAction.idl b/third_party/WebKit/Source/modules/notifications/NotificationAction.idl index 044c054..be78856 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationAction.idl +++ b/third_party/WebKit/Source/modules/notifications/NotificationAction.idl
@@ -7,4 +7,5 @@ dictionary NotificationAction { required DOMString action; required DOMString title; + [RuntimeEnabled=NotificationActionIcons] USVString icon; };
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationData.cpp b/third_party/WebKit/Source/modules/notifications/NotificationData.cpp index d7bc93f..71e2e9b 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationData.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationData.cpp
@@ -11,7 +11,6 @@ #include "modules/notifications/Notification.h" #include "modules/notifications/NotificationOptions.h" #include "modules/vibration/NavigatorVibration.h" -#include "platform/RuntimeEnabledFeatures.h" #include "platform/weborigin/KURL.h" #include "wtf/CurrentTime.h" @@ -48,7 +47,6 @@ KURL iconUrl; - // TODO(peter): Apply the appropriate CORS checks on the |iconUrl|. if (options.hasIcon() && !options.icon().isEmpty()) { iconUrl = executionContext->completeURL(options.icon()); if (!iconUrl.isValid()) @@ -83,6 +81,14 @@ webAction.action = action.action(); webAction.title = action.title(); + KURL iconUrl; + if (action.hasIcon() && !action.icon().isEmpty()) { + iconUrl = executionContext->completeURL(action.icon()); + if (!iconUrl.isValid()) + iconUrl = KURL(); + } + webAction.icon = iconUrl; + actions.append(webAction); }
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp index 0a030bb..138423b8 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -24,6 +24,7 @@ const char kNotificationBody[] = "Hello, world"; const char kNotificationTag[] = "my_tag"; const char kNotificationIcon[] = "https://example.com/icon.png"; +const char kNotificationIconInvalid[] = "https://invalid:icon:url"; const unsigned kNotificationVibration[] = { 42, 10, 20, 30, 40 }; const unsigned long long kNotificationTimestamp = 621046800ull; const bool kNotificationSilent = false; @@ -31,6 +32,7 @@ const char kNotificationActionAction[] = "my_action"; const char kNotificationActionTitle[] = "My Action"; +const char kNotificationActionIcon[] = "https://example.com/action_icon.png"; const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; const int kNotificationVibrationNormalized[] = { 10, 10000, 50 }; @@ -62,6 +64,7 @@ NotificationAction action; action.setAction(kNotificationActionAction); action.setTitle(kNotificationActionTitle); + action.setIcon(kNotificationActionIcon); actions.append(action); } @@ -91,7 +94,7 @@ EXPECT_EQ(kNotificationBody, notificationData.body); EXPECT_EQ(kNotificationTag, notificationData.tag); - // TODO(peter): Test notificationData.icon when ExecutionContext::completeURL() works in this test. + // TODO(peter): Test WebNotificationData.icon and WebNotificationAction.icon when ExecutionContext::completeURL() works in this test. ASSERT_EQ(vibrationPattern.size(), notificationData.vibrate.size()); for (size_t i = 0; i < vibrationPattern.size(); ++i) @@ -101,6 +104,10 @@ EXPECT_EQ(kNotificationSilent, notificationData.silent); EXPECT_EQ(kNotificationRequireInteraction, notificationData.requireInteraction); EXPECT_EQ(actions.size(), notificationData.actions.size()); + for (const auto& action : notificationData.actions) { + EXPECT_EQ(kNotificationActionAction, action.action); + EXPECT_EQ(kNotificationActionTitle, action.title); + } } TEST_F(NotificationDataTest, SilentNotificationWithVibration) @@ -123,16 +130,28 @@ EXPECT_EQ("Silent notifications must not specify vibration patterns.", exceptionState.message()); } -TEST_F(NotificationDataTest, InvalidIconUrl) +TEST_F(NotificationDataTest, InvalidIconUrls) { + HeapVector<NotificationAction> actions; + for (size_t i = 0; i < Notification::maxActions(); ++i) { + NotificationAction action; + action.setAction(kNotificationActionAction); + action.setTitle(kNotificationActionTitle); + action.setIcon(kNotificationIconInvalid); + actions.append(action); + } + NotificationOptions options; - options.setIcon("https://invalid:icon:url"); + options.setIcon(kNotificationIconInvalid); + options.setActions(actions); TrackExceptionState exceptionState; WebNotificationData notificationData = createWebNotificationData(executionContext(), kNotificationTitle, options, exceptionState); ASSERT_FALSE(exceptionState.hadException()); EXPECT_TRUE(notificationData.icon.isEmpty()); + for (const auto& action : notificationData.actions) + EXPECT_TRUE(action.icon.isEmpty()); } TEST_F(NotificationDataTest, VibrationNormalization)
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp index ed5c0ab2..53ae883 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
@@ -10,6 +10,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "core/dom/Document.h" #include "core/dom/ExecutionContext.h" +#include "core/frame/Settings.h" #include "core/frame/UseCounter.h" #include "modules/EventTargetModules.h" #include "modules/presentation/PresentationAvailability.h" @@ -36,6 +37,14 @@ return controller ? controller->client() : nullptr; } +Settings* settings(ExecutionContext* executionContext) +{ + ASSERT(executionContext && executionContext->isDocument()); + + Document* document = toDocument(executionContext); + return document->settings(); +} + } // anonymous namespace // static @@ -85,7 +94,10 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); - if (!UserGestureIndicator::processingUserGesture()) { + Settings* contextSettings = settings(executionContext()); + bool isUserGestureRequired = !contextSettings || contextSettings->presentationRequiresUserGesture(); + + if (isUserGestureRequired && !UserGestureIndicator::processingUserGesture()) { resolver->reject(DOMException::create(InvalidAccessError, "PresentationRequest::start() requires user gesture.")); return promise; }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index b5715e16..14a5e50dd 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -6251,7 +6251,7 @@ synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); return false; } - if (transpose) { + if (transpose && !isWebGL2OrHigher()) { synthesizeGLError(GL_INVALID_VALUE, functionName, "transpose not FALSE"); return false; }
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index 5edf6dc..f326589 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -223,6 +223,7 @@ ] public_deps = [ + ":make_platform_generated", "//base", "//cc", "//gpu/command_buffer/client:gles2_c_lib", @@ -238,7 +239,6 @@ "//v8", ] deps = [ - ":make_platform_generated", "//third_party/WebKit/Source/platform/heap", "//third_party/harfbuzz-ng", "//third_party/icu",
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in index 4fdf5b04..a4837465 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
@@ -124,6 +124,7 @@ NewMediaPlaybackUi NotificationConstructor status=stable NotificationExperimental status=test +NotificationActionIcons status=test Notifications status=stable OrientationEvent // For simulating Android's overlay fullscreen video in layout tests on Linux.
diff --git a/third_party/WebKit/Source/platform/UserGestureIndicatorTest.cpp b/third_party/WebKit/Source/platform/UserGestureIndicatorTest.cpp new file mode 100644 index 0000000..d3dcde9d --- /dev/null +++ b/third_party/WebKit/Source/platform/UserGestureIndicatorTest.cpp
@@ -0,0 +1,102 @@ +// Copyright (c) 2016 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. + +#include "platform/UserGestureIndicator.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +// Checks for the initial state of UserGestureIndicator. +TEST(UserGestureIndicatorTest, InitialState) +{ + EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); + EXPECT_FALSE(UserGestureIndicator::processedUserGestureSinceLoad()); + EXPECT_EQ(nullptr, UserGestureIndicator::currentToken()); + EXPECT_FALSE(UserGestureIndicator::consumeUserGesture()); +} + +TEST(UserGestureIndicatorTest, ConstructedWithNewUserGesture) +{ + UserGestureIndicator::clearProcessedUserGestureSinceLoad(); + UserGestureIndicator userGestureScope(DefinitelyProcessingNewUserGesture); + + EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); + EXPECT_TRUE(UserGestureIndicator::processedUserGestureSinceLoad()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + + EXPECT_TRUE(UserGestureIndicator::consumeUserGesture()); +} + +TEST(UserGestureIndicatorTest, ConstructedWithUserGesture) +{ + UserGestureIndicator::clearProcessedUserGestureSinceLoad(); + UserGestureIndicator userGestureScope(DefinitelyProcessingUserGesture); + + EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); + EXPECT_TRUE(UserGestureIndicator::processedUserGestureSinceLoad()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + + EXPECT_TRUE(UserGestureIndicator::consumeUserGesture()); +} + +TEST(UserGestureIndicatorTest, ConstructedWithNoUserGesture) +{ + UserGestureIndicator::clearProcessedUserGestureSinceLoad(); + UserGestureIndicator userGestureScope(DefinitelyNotProcessingUserGesture); + + EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); + EXPECT_FALSE(UserGestureIndicator::processedUserGestureSinceLoad()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + + EXPECT_FALSE(UserGestureIndicator::consumeUserGesture()); +} + +// Check that after UserGestureIndicator destruction state will be cleared. +TEST(UserGestureIndicatorTest, DestructUserGestureIndicator) +{ + { + UserGestureIndicator userGestureScope(DefinitelyProcessingUserGesture); + + EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); + EXPECT_TRUE(UserGestureIndicator::processedUserGestureSinceLoad()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + } + + EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); + EXPECT_EQ(nullptr, UserGestureIndicator::currentToken()); + EXPECT_FALSE(UserGestureIndicator::consumeUserGesture()); +} + +// Tests creation of scoped UserGestureIndicator objects. +TEST(UserGestureIndicatorTest, ScopedNewUserGestureIndicators) +{ + // Root GestureIndicator and GestureToken. + UserGestureIndicator userGestureScope(DefinitelyProcessingNewUserGesture); + + EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); + EXPECT_TRUE(UserGestureIndicator::processedUserGestureSinceLoad()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + { + // Construct inner UserGestureIndicator. + // It should share GestureToken with the root indicator. + UserGestureIndicator innerUserGesture(DefinitelyProcessingNewUserGesture); + + EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + + // Consume inner gesture. + EXPECT_TRUE(UserGestureIndicator::consumeUserGesture()); + } + + EXPECT_TRUE(UserGestureIndicator::processingUserGesture()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); + + // Consume root gesture. + EXPECT_TRUE(UserGestureIndicator::consumeUserGesture()); + EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); + EXPECT_NE(nullptr, UserGestureIndicator::currentToken()); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/platform/blink_platform.gyp b/third_party/WebKit/Source/platform/blink_platform.gyp index de4f969..baa3a0a 100644 --- a/third_party/WebKit/Source/platform/blink_platform.gyp +++ b/third_party/WebKit/Source/platform/blink_platform.gyp
@@ -146,6 +146,7 @@ '<(libjpeg_gyp_path):libjpeg', ], 'export_dependent_settings': [ + 'platform_generated.gyp:make_platform_generated', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib',
diff --git a/third_party/WebKit/Source/platform/blink_platform.gypi b/third_party/WebKit/Source/platform/blink_platform.gypi index 5f5a414..6e02e80 100644 --- a/third_party/WebKit/Source/platform/blink_platform.gypi +++ b/third_party/WebKit/Source/platform/blink_platform.gypi
@@ -885,6 +885,7 @@ 'scroll/ScrollbarThemeOverlay.cpp', 'scroll/ScrollbarThemeOverlay.h', 'scroll/ScrollbarThemeOverlayMock.h', + 'scroll/ScrollStateData.h', 'speech/PlatformSpeechSynthesisUtterance.cpp', 'speech/PlatformSpeechSynthesisUtterance.h', 'speech/PlatformSpeechSynthesisVoice.cpp', @@ -1007,6 +1008,7 @@ 'SharedBufferTest.cpp', 'TimerTest.cpp', 'TracedValueTest.cpp', + 'UserGestureIndicatorTest.cpp', 'UUIDTest.cpp', 'WebScreenInfoTest.cpp', 'WebVectorTest.cpp',
diff --git a/third_party/WebKit/Source/platform/heap/CallbackStack.cpp b/third_party/WebKit/Source/platform/heap/CallbackStack.cpp index 4882384..c76db50 100644 --- a/third_party/WebKit/Source/platform/heap/CallbackStack.cpp +++ b/third_party/WebKit/Source/platform/heap/CallbackStack.cpp
@@ -3,14 +3,46 @@ // found in the LICENSE file. #include "platform/heap/CallbackStack.h" +#include "wtf/PageAllocator.h" namespace blink { -void CallbackStack::Block::clear() +CallbackStack::Block::Block(Block* next) { + static_assert((blockSize * sizeof(Item)) % WTF::kPageAllocationGranularity == 0, "CallbackStack::blockSize * sizeof(Item) must be a multiple of WTF::kPageAllocationGranularity"); + m_buffer = static_cast<Item*>(WTF::allocPages(nullptr, blockSize * sizeof(Item), WTF::kPageAllocationGranularity, WTF::PageAccessible)); + RELEASE_ASSERT(m_buffer); + +#if ENABLE(ASSERT) + for (size_t i = 0; i < blockSize; i++) + m_buffer[i] = Item(0, 0); +#endif + + m_limit = &(m_buffer[blockSize]); + m_current = &(m_buffer[0]); + m_next = next; +} + +CallbackStack::Block::~Block() +{ + WTF::freePages(m_buffer, blockSize * sizeof(Item)); + m_buffer = nullptr; + m_limit = nullptr; + m_current = nullptr; + m_next = nullptr; +} + +void CallbackStack::Block::decommit() +{ +#if ENABLE(ASSERT) + for (size_t i = 0; i < blockSize; i++) + m_buffer[i] = Item(0, 0); +#endif + + WTF::discardSystemPages(m_buffer, blockSize * sizeof(Item)); + m_current = &m_buffer[0]; m_next = nullptr; - clearUnused(); } void CallbackStack::Block::invokeEphemeronCallbacks(Visitor* visitor) @@ -35,34 +67,28 @@ } #endif -void CallbackStack::Block::clearUnused() -{ -#if ENABLE(ASSERT) - for (size_t i = 0; i < blockSize; i++) - m_buffer[i] = Item(0, 0); -#endif -} - -CallbackStack::CallbackStack() : m_first(new Block(0)), m_last(m_first) +CallbackStack::CallbackStack() + : m_first(new Block(0)) + , m_last(m_first) { } CallbackStack::~CallbackStack() { - clear(); + RELEASE_ASSERT(isEmpty()); delete m_first; m_first = nullptr; m_last = nullptr; } -void CallbackStack::clear() +void CallbackStack::decommit() { Block* next; for (Block* current = m_first->next(); current; current = next) { next = current->next(); delete current; } - m_first->clear(); + m_first->decommit(); m_last = m_first; } @@ -86,7 +112,7 @@ Block* next = m_first->next(); if (!next) { #if ENABLE(ASSERT) - m_first->clear(); + m_first->decommit(); #endif return nullptr; }
diff --git a/third_party/WebKit/Source/platform/heap/CallbackStack.h b/third_party/WebKit/Source/platform/heap/CallbackStack.h index 0d60ebc3..b961e91 100644 --- a/third_party/WebKit/Source/platform/heap/CallbackStack.h +++ b/third_party/WebKit/Source/platform/heap/CallbackStack.h
@@ -41,6 +41,7 @@ ~CallbackStack(); void clear(); + void decommit(); Item* allocateEntry(); Item* pop(); @@ -54,25 +55,15 @@ #endif private: - static const size_t blockSize = 8192; + static const size_t blockSize = (1 << 13); class Block { USING_FAST_MALLOC(Block); public: - explicit Block(Block* next) - : m_limit(&(m_buffer[blockSize])) - , m_current(&(m_buffer[0])) - , m_next(next) - { - clearUnused(); - } + explicit Block(Block* next); + ~Block(); - ~Block() - { - clearUnused(); - } - - void clear(); + void decommit(); Block* next() const { return m_next; } void setNext(Block* next) { m_next = next; } @@ -82,11 +73,6 @@ return m_current == &(m_buffer[0]); } - size_t size() const - { - return blockSize - (m_limit - m_current); - } - Item* allocateEntry() { if (LIKELY(m_current < m_limit)) @@ -107,9 +93,7 @@ #endif private: - void clearUnused(); - - Item m_buffer[blockSize]; + Item* m_buffer; Item* m_limit; Item* m_current; Block* m_next;
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index 8a414e3e..5f2809b 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -355,6 +355,14 @@ } #endif +void Heap::decommitCallbackStacks() +{ + s_markingStack->decommit(); + s_postMarkingCallbackStack->decommit(); + s_globalWeakCallbackStack->decommit(); + s_ephemeronStack->decommit(); +} + void Heap::preGC() { ASSERT(!ThreadState::current()->isInGC()); @@ -469,6 +477,7 @@ WTF::Partitions::reportMemoryUsageHistogram(); postGC(gcType); + Heap::decommitCallbackStacks(); #if ENABLE(ASSERT) // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneration. @@ -511,6 +520,7 @@ globalWeakProcessing(gcScope.visitor()); state->postGC(BlinkGC::GCWithSweep); + Heap::decommitCallbackStacks(); } state->preSweep(); } @@ -547,8 +557,6 @@ // if they are only reachable from their front objects. while (popAndInvokePostMarkingCallback(visitor)) { } - s_ephemeronStack->clear(); - // Post-marking callbacks should not trace any objects and // therefore the marking stack should be empty after the // post-marking callbacks.
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h index 9a6a940f..21999331 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.h +++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -279,6 +279,8 @@ static int heapIndexForObjectSize(size_t); static bool isNormalHeapIndex(int); + static void decommitCallbackStacks(); + static CallbackStack* s_markingStack; static CallbackStack* s_postMarkingCallbackStack; static CallbackStack* s_globalWeakCallbackStack;
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 2b953d83..b20488f1 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -484,6 +484,8 @@ // Perform thread-specific weak processing. while (popAndInvokeThreadLocalWeakCallback(&weakProcessingVisitor)) { } + m_threadLocalWeakCallbackStack->decommit(); + if (isMainThread()) { double timeForThreadLocalWeakProcessing = WTF::currentTimeMS() - startTime; DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForWeakHistogram, ("BlinkGC.timeForThreadLocalWeakProcessing", 1, 10 * 1000, 50));
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollStateData.h b/third_party/WebKit/Source/platform/scroll/ScrollStateData.h new file mode 100644 index 0000000..07e7ebd --- /dev/null +++ b/third_party/WebKit/Source/platform/scroll/ScrollStateData.h
@@ -0,0 +1,22 @@ +// Copyright 2016 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 ScrollStateData_h +#define ScrollStateData_h + +#include "cc/input/scroll_state.h" + +namespace blink { + +// A wrapper around cc's structure to expose it to core. +struct ScrollStateData : public cc::ScrollStateData { + ScrollStateData() + : cc::ScrollStateData() + { + } +}; + +} // namespace blink + +#endif
diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.cpp b/third_party/WebKit/Source/web/WebSettingsImpl.cpp index 737f088..a7e348cb 100644 --- a/third_party/WebKit/Source/web/WebSettingsImpl.cpp +++ b/third_party/WebKit/Source/web/WebSettingsImpl.cpp
@@ -717,6 +717,11 @@ m_settings->setMediaPlaybackRequiresUserGesture(required); } +void WebSettingsImpl::setPresentationRequiresUserGesture(bool required) +{ + m_settings->setPresentationRequiresUserGesture(required); +} + void WebSettingsImpl::setViewportEnabled(bool enabled) { m_settings->setViewportEnabled(enabled);
diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.h b/third_party/WebKit/Source/web/WebSettingsImpl.h index 411353e9..1708e83 100644 --- a/third_party/WebKit/Source/web/WebSettingsImpl.h +++ b/third_party/WebKit/Source/web/WebSettingsImpl.h
@@ -114,6 +114,7 @@ void setMaxTouchPoints(int) override; void setMediaControlsOverlayPlayButtonEnabled(bool) override; void setMediaPlaybackRequiresUserGesture(bool) override; + void setPresentationRequiresUserGesture(bool) override; void setMinimumAccelerated2dCanvasSize(int) override; void setMinimumFontSize(int) override; void setMinimumLogicalFontSize(int) override;
diff --git a/third_party/WebKit/Source/web/web.gyp b/third_party/WebKit/Source/web/web.gyp index 4260cc7..a9d6ffb 100644 --- a/third_party/WebKit/Source/web/web.gyp +++ b/third_party/WebKit/Source/web/web.gyp
@@ -57,6 +57,7 @@ '../config.gyp:config', '../platform/blink_platform.gyp:blink_common', '../modules/modules.gyp:modules', + '<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/skia/skia.gyp:skia', '<(angle_path)/src/angle.gyp:translator', '<(DEPTH)/third_party/icu/icu.gyp:icuuc',
diff --git a/third_party/WebKit/public/blink_headers.gypi b/third_party/WebKit/public/blink_headers.gypi index 5fc5dcd..6034a00 100644 --- a/third_party/WebKit/public/blink_headers.gypi +++ b/third_party/WebKit/public/blink_headers.gypi
@@ -194,7 +194,6 @@ "platform/WebScrollbarLayer.h", "platform/WebScrollbarThemeGeometry.h", "platform/WebScrollbarThemePainter.h", - "platform/WebScrollStateData.h", "platform/WebSecurityOrigin.h", "platform/WebSelectionBound.h", "platform/WebSetSinkIdCallbacks.h",
diff --git a/third_party/WebKit/public/platform/WebScrollStateData.h b/third_party/WebKit/public/platform/WebScrollStateData.h deleted file mode 100644 index f7154bb0..0000000 --- a/third_party/WebKit/public/platform/WebScrollStateData.h +++ /dev/null
@@ -1,68 +0,0 @@ -// Copyright 2015 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 WebScrollStateData_h -#define WebScrollStateData_h - -#include "WebCommon.h" - -#include <deque> - -namespace blink { - -// WebScrollState data contains the data used by blink::ScrollState. This is -// used by the scroll customization API, detailed here (https://goo.gl/1ipTpP). -// For the cc equivalent, see cc::ScrollStateData and cc::ScrollState. -struct BLINK_EXPORT WebScrollStateData { - WebScrollStateData(double deltaX, double deltaY, double deltaGranularity, - double velocityX, double velocityY, bool inInertialPhase, - bool isBeginning = false, bool isEnding = false, - bool fromUserInput = false, bool shouldPropagate = true, - bool deltaConsumedForScrollSequence = false) - : deltaX(deltaX) - , deltaY(deltaY) - , deltaGranularity(deltaGranularity) - , velocityX(velocityX) - , velocityY(velocityY) - , inInertialPhase(inInertialPhase) - , isBeginning(isBeginning) - , isEnding(isEnding) - , fromUserInput(fromUserInput) - , shouldPropagate(shouldPropagate) - , currentNativeScrollingElement(0) - , deltaConsumedForScrollSequence(deltaConsumedForScrollSequence) - , causedScrollX(false) - , causedScrollY(false) - { - } - - WebScrollStateData() - : WebScrollStateData(0, 0, 0, 0, 0, false) - { - } - - double deltaX; - double deltaY; - double deltaGranularity; - double velocityX; - double velocityY; - bool inInertialPhase; - bool isBeginning; - bool isEnding; - - bool fromUserInput; - bool shouldPropagate; - // The id of the last native element to respond to a scroll, or 0 if none exists. - int currentNativeScrollingElement; - // Whether the scroll sequence has had any delta consumed, in the - // current frame, or any child frames. - bool deltaConsumedForScrollSequence; - - bool causedScrollX; - bool causedScrollY; -}; - -} // namespace blink - -#endif // WebScrollStateData_h
diff --git a/third_party/WebKit/public/platform/modules/notifications/WebNotificationAction.h b/third_party/WebKit/public/platform/modules/notifications/WebNotificationAction.h index 3a2026d..c42b47d 100644 --- a/third_party/WebKit/public/platform/modules/notifications/WebNotificationAction.h +++ b/third_party/WebKit/public/platform/modules/notifications/WebNotificationAction.h
@@ -6,23 +6,15 @@ #define WebNotificationAction_h #include "public/platform/WebString.h" +#include "public/platform/WebURL.h" namespace blink { // Structure representing the data associated with a Web Notification action. struct WebNotificationAction { - // Empty and copy constructor only for WebVector. - WebNotificationAction() = default; - WebNotificationAction(const WebNotificationAction&) = default; - - WebNotificationAction(const WebString& action, const WebString& title) - : action(action) - , title(title) - { - } - WebString action; WebString title; + WebURL icon; }; } // namespace blink
diff --git a/third_party/WebKit/public/web/WebSettings.h b/third_party/WebKit/public/web/WebSettings.h index efea84d6..8451a160 100644 --- a/third_party/WebKit/public/web/WebSettings.h +++ b/third_party/WebKit/public/web/WebSettings.h
@@ -169,6 +169,7 @@ virtual void setMaxTouchPoints(int) = 0; virtual void setMediaControlsOverlayPlayButtonEnabled(bool) = 0; virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; + virtual void setPresentationRequiresUserGesture(bool) = 0; virtual void setMinimumAccelerated2dCanvasSize(int) = 0; virtual void setMinimumFontSize(int) = 0; virtual void setMinimumLogicalFontSize(int) = 0;
diff --git a/third_party/libjingle/BUILD.gn b/third_party/libjingle/BUILD.gn index bc2c3e7..be97212 100644 --- a/third_party/libjingle/BUILD.gn +++ b/third_party/libjingle/BUILD.gn
@@ -296,6 +296,78 @@ # as is supported in the GYP build. It's not clear what this is used for. source_set("libjingle_webrtc_common") { sources = [ + "../webrtc/api/audiotrack.cc", + "../webrtc/api/audiotrack.h", + "../webrtc/api/datachannel.cc", + "../webrtc/api/datachannel.h", + "../webrtc/api/dtlsidentitystore.cc", + "../webrtc/api/dtlsidentitystore.h", + "../webrtc/api/dtmfsender.cc", + "../webrtc/api/dtmfsender.h", + "../webrtc/api/jsep.h", + "../webrtc/api/jsepicecandidate.cc", + "../webrtc/api/jsepicecandidate.h", + "../webrtc/api/jsepsessiondescription.cc", + "../webrtc/api/jsepsessiondescription.h", + "../webrtc/api/localaudiosource.cc", + "../webrtc/api/localaudiosource.h", + "../webrtc/api/mediaconstraintsinterface.cc", + "../webrtc/api/mediaconstraintsinterface.h", + "../webrtc/api/mediacontroller.cc", + "../webrtc/api/mediacontroller.h", + "../webrtc/api/mediastream.cc", + "../webrtc/api/mediastream.h", + "../webrtc/api/mediastreamhandler.cc", + "../webrtc/api/mediastreamhandler.h", + "../webrtc/api/mediastreaminterface.h", + "../webrtc/api/mediastreamobserver.cc", + "../webrtc/api/mediastreamobserver.h", + "../webrtc/api/mediastreamprovider.h", + "../webrtc/api/mediastreamproxy.h", + "../webrtc/api/mediastreamtrack.h", + "../webrtc/api/mediastreamtrackproxy.h", + "../webrtc/api/notifier.h", + "../webrtc/api/peerconnection.cc", + "../webrtc/api/peerconnection.h", + "../webrtc/api/peerconnectionfactory.cc", + "../webrtc/api/peerconnectionfactory.h", + "../webrtc/api/peerconnectioninterface.h", + "../webrtc/api/portallocatorfactory.cc", + "../webrtc/api/portallocatorfactory.h", + "../webrtc/api/remoteaudiosource.cc", + "../webrtc/api/remoteaudiosource.h", + "../webrtc/api/remoteaudiotrack.cc", + "../webrtc/api/remoteaudiotrack.h", + "../webrtc/api/remotevideocapturer.cc", + "../webrtc/api/remotevideocapturer.h", + "../webrtc/api/rtpreceiver.cc", + "../webrtc/api/rtpreceiver.h", + "../webrtc/api/rtpreceiverinterface.h", + "../webrtc/api/rtpsender.cc", + "../webrtc/api/rtpsender.h", + "../webrtc/api/rtpsenderinterface.h", + "../webrtc/api/sctputils.cc", + "../webrtc/api/sctputils.h", + "../webrtc/api/statscollector.cc", + "../webrtc/api/statscollector.h", + "../webrtc/api/statstypes.cc", + "../webrtc/api/statstypes.h", + "../webrtc/api/streamcollection.h", + "../webrtc/api/umametrics.h", + "../webrtc/api/videosource.cc", + "../webrtc/api/videosource.h", + "../webrtc/api/videosourceinterface.h", + "../webrtc/api/videosourceproxy.h", + "../webrtc/api/videotrack.cc", + "../webrtc/api/videotrack.h", + "../webrtc/api/videotrackrenderers.cc", + "../webrtc/api/videotrackrenderers.h", + "../webrtc/api/webrtcsdp.cc", + "../webrtc/api/webrtcsdp.h", + "../webrtc/api/webrtcsession.cc", + "../webrtc/api/webrtcsession.h", + "../webrtc/api/webrtcsessiondescriptionfactory.cc", + "../webrtc/api/webrtcsessiondescriptionfactory.h", "../webrtc/media/base/audiorenderer.h", "../webrtc/media/base/capturemanager.cc", "../webrtc/media/base/capturemanager.h", @@ -338,78 +410,6 @@ "../webrtc/media/webrtc/webrtcvideoframefactory.cc", "../webrtc/media/webrtc/webrtcvideoframefactory.h", "../webrtc/media/webrtc/webrtcvoe.h", - "source/talk/app/webrtc/audiotrack.cc", - "source/talk/app/webrtc/audiotrack.h", - "source/talk/app/webrtc/datachannel.cc", - "source/talk/app/webrtc/datachannel.h", - "source/talk/app/webrtc/dtlsidentitystore.cc", - "source/talk/app/webrtc/dtlsidentitystore.h", - "source/talk/app/webrtc/dtmfsender.cc", - "source/talk/app/webrtc/dtmfsender.h", - "source/talk/app/webrtc/jsep.h", - "source/talk/app/webrtc/jsepicecandidate.cc", - "source/talk/app/webrtc/jsepicecandidate.h", - "source/talk/app/webrtc/jsepsessiondescription.cc", - "source/talk/app/webrtc/jsepsessiondescription.h", - "source/talk/app/webrtc/localaudiosource.cc", - "source/talk/app/webrtc/localaudiosource.h", - "source/talk/app/webrtc/mediaconstraintsinterface.cc", - "source/talk/app/webrtc/mediaconstraintsinterface.h", - "source/talk/app/webrtc/mediacontroller.cc", - "source/talk/app/webrtc/mediacontroller.h", - "source/talk/app/webrtc/mediastream.cc", - "source/talk/app/webrtc/mediastream.h", - "source/talk/app/webrtc/mediastreamhandler.cc", - "source/talk/app/webrtc/mediastreamhandler.h", - "source/talk/app/webrtc/mediastreaminterface.h", - "source/talk/app/webrtc/mediastreamobserver.cc", - "source/talk/app/webrtc/mediastreamobserver.h", - "source/talk/app/webrtc/mediastreamprovider.h", - "source/talk/app/webrtc/mediastreamproxy.h", - "source/talk/app/webrtc/mediastreamtrack.h", - "source/talk/app/webrtc/mediastreamtrackproxy.h", - "source/talk/app/webrtc/notifier.h", - "source/talk/app/webrtc/peerconnection.cc", - "source/talk/app/webrtc/peerconnection.h", - "source/talk/app/webrtc/peerconnectionfactory.cc", - "source/talk/app/webrtc/peerconnectionfactory.h", - "source/talk/app/webrtc/peerconnectioninterface.h", - "source/talk/app/webrtc/portallocatorfactory.cc", - "source/talk/app/webrtc/portallocatorfactory.h", - "source/talk/app/webrtc/remoteaudiosource.cc", - "source/talk/app/webrtc/remoteaudiosource.h", - "source/talk/app/webrtc/remoteaudiotrack.cc", - "source/talk/app/webrtc/remoteaudiotrack.h", - "source/talk/app/webrtc/remotevideocapturer.cc", - "source/talk/app/webrtc/remotevideocapturer.h", - "source/talk/app/webrtc/rtpreceiver.cc", - "source/talk/app/webrtc/rtpreceiver.h", - "source/talk/app/webrtc/rtpreceiverinterface.h", - "source/talk/app/webrtc/rtpsender.cc", - "source/talk/app/webrtc/rtpsender.h", - "source/talk/app/webrtc/rtpsenderinterface.h", - "source/talk/app/webrtc/sctputils.cc", - "source/talk/app/webrtc/sctputils.h", - "source/talk/app/webrtc/statscollector.cc", - "source/talk/app/webrtc/statscollector.h", - "source/talk/app/webrtc/statstypes.cc", - "source/talk/app/webrtc/statstypes.h", - "source/talk/app/webrtc/streamcollection.h", - "source/talk/app/webrtc/umametrics.h", - "source/talk/app/webrtc/videosource.cc", - "source/talk/app/webrtc/videosource.h", - "source/talk/app/webrtc/videosourceinterface.h", - "source/talk/app/webrtc/videosourceproxy.h", - "source/talk/app/webrtc/videotrack.cc", - "source/talk/app/webrtc/videotrack.h", - "source/talk/app/webrtc/videotrackrenderers.cc", - "source/talk/app/webrtc/videotrackrenderers.h", - "source/talk/app/webrtc/webrtcsdp.cc", - "source/talk/app/webrtc/webrtcsdp.h", - "source/talk/app/webrtc/webrtcsession.cc", - "source/talk/app/webrtc/webrtcsession.h", - "source/talk/app/webrtc/webrtcsessiondescriptionfactory.cc", - "source/talk/app/webrtc/webrtcsessiondescriptionfactory.h", "source/talk/session/media/audiomonitor.cc", "source/talk/session/media/audiomonitor.h", "source/talk/session/media/bundlefilter.cc",
diff --git a/third_party/libjingle/README.chromium b/third_party/libjingle/README.chromium index af65653..264d4df 100644 --- a/third_party/libjingle/README.chromium +++ b/third_party/libjingle/README.chromium
@@ -1,7 +1,7 @@ Name: libjingle URL: http://www.webrtc.org Version: unknown -Revision: 11522 +Revision: 11551 License: BSD License File: source/talk/COPYING Security Critical: yes
diff --git a/third_party/libjingle/libjingle.gyp b/third_party/libjingle/libjingle.gyp index a079f01..c2d7352 100644 --- a/third_party/libjingle/libjingle.gyp +++ b/third_party/libjingle/libjingle.gyp
@@ -256,6 +256,78 @@ 'target_name': 'libjingle_webrtc_common', 'type': 'static_library', 'sources': [ + '<(DEPTH)/third_party/webrtc/api/audiotrack.cc', + '<(DEPTH)/third_party/webrtc/api/audiotrack.h', + '<(DEPTH)/third_party/webrtc/api/datachannel.cc', + '<(DEPTH)/third_party/webrtc/api/datachannel.h', + '<(DEPTH)/third_party/webrtc/api/dtlsidentitystore.cc', + '<(DEPTH)/third_party/webrtc/api/dtlsidentitystore.h', + '<(DEPTH)/third_party/webrtc/api/dtmfsender.cc', + '<(DEPTH)/third_party/webrtc/api/dtmfsender.h', + '<(DEPTH)/third_party/webrtc/api/jsep.h', + '<(DEPTH)/third_party/webrtc/api/jsepicecandidate.cc', + '<(DEPTH)/third_party/webrtc/api/jsepicecandidate.h', + '<(DEPTH)/third_party/webrtc/api/jsepsessiondescription.cc', + '<(DEPTH)/third_party/webrtc/api/jsepsessiondescription.h', + '<(DEPTH)/third_party/webrtc/api/localaudiosource.cc', + '<(DEPTH)/third_party/webrtc/api/localaudiosource.h', + '<(DEPTH)/third_party/webrtc/api/mediaconstraintsinterface.cc', + '<(DEPTH)/third_party/webrtc/api/mediaconstraintsinterface.h', + '<(DEPTH)/third_party/webrtc/api/mediacontroller.cc', + '<(DEPTH)/third_party/webrtc/api/mediacontroller.h', + '<(DEPTH)/third_party/webrtc/api/mediastream.cc', + '<(DEPTH)/third_party/webrtc/api/mediastream.h', + '<(DEPTH)/third_party/webrtc/api/mediastreamhandler.cc', + '<(DEPTH)/third_party/webrtc/api/mediastreamhandler.h', + '<(DEPTH)/third_party/webrtc/api/mediastreaminterface.h', + '<(DEPTH)/third_party/webrtc/api/mediastreamobserver.cc', + '<(DEPTH)/third_party/webrtc/api/mediastreamobserver.h', + '<(DEPTH)/third_party/webrtc/api/mediastreamprovider.h', + '<(DEPTH)/third_party/webrtc/api/mediastreamproxy.h', + '<(DEPTH)/third_party/webrtc/api/mediastreamtrack.h', + '<(DEPTH)/third_party/webrtc/api/mediastreamtrackproxy.h', + '<(DEPTH)/third_party/webrtc/api/notifier.h', + '<(DEPTH)/third_party/webrtc/api/peerconnection.cc', + '<(DEPTH)/third_party/webrtc/api/peerconnection.h', + '<(DEPTH)/third_party/webrtc/api/peerconnectionfactory.cc', + '<(DEPTH)/third_party/webrtc/api/peerconnectionfactory.h', + '<(DEPTH)/third_party/webrtc/api/peerconnectioninterface.h', + '<(DEPTH)/third_party/webrtc/api/portallocatorfactory.cc', + '<(DEPTH)/third_party/webrtc/api/portallocatorfactory.h', + '<(DEPTH)/third_party/webrtc/api/remoteaudiosource.cc', + '<(DEPTH)/third_party/webrtc/api/remoteaudiosource.h', + '<(DEPTH)/third_party/webrtc/api/remoteaudiotrack.cc', + '<(DEPTH)/third_party/webrtc/api/remoteaudiotrack.h', + '<(DEPTH)/third_party/webrtc/api/remotevideocapturer.cc', + '<(DEPTH)/third_party/webrtc/api/remotevideocapturer.h', + '<(DEPTH)/third_party/webrtc/api/rtpreceiver.cc', + '<(DEPTH)/third_party/webrtc/api/rtpreceiver.h', + '<(DEPTH)/third_party/webrtc/api/rtpreceiverinterface.h', + '<(DEPTH)/third_party/webrtc/api/rtpsender.cc', + '<(DEPTH)/third_party/webrtc/api/rtpsender.h', + '<(DEPTH)/third_party/webrtc/api/rtpsenderinterface.h', + '<(DEPTH)/third_party/webrtc/api/sctputils.cc', + '<(DEPTH)/third_party/webrtc/api/sctputils.h', + '<(DEPTH)/third_party/webrtc/api/statscollector.cc', + '<(DEPTH)/third_party/webrtc/api/statscollector.h', + '<(DEPTH)/third_party/webrtc/api/statstypes.cc', + '<(DEPTH)/third_party/webrtc/api/statstypes.h', + '<(DEPTH)/third_party/webrtc/api/streamcollection.h', + '<(DEPTH)/third_party/webrtc/api/umametrics.h', + '<(DEPTH)/third_party/webrtc/api/videosource.cc', + '<(DEPTH)/third_party/webrtc/api/videosource.h', + '<(DEPTH)/third_party/webrtc/api/videosourceinterface.h', + '<(DEPTH)/third_party/webrtc/api/videosourceproxy.h', + '<(DEPTH)/third_party/webrtc/api/videotrack.cc', + '<(DEPTH)/third_party/webrtc/api/videotrack.h', + '<(DEPTH)/third_party/webrtc/api/videotrackrenderers.cc', + '<(DEPTH)/third_party/webrtc/api/videotrackrenderers.h', + '<(DEPTH)/third_party/webrtc/api/webrtcsdp.cc', + '<(DEPTH)/third_party/webrtc/api/webrtcsdp.h', + '<(DEPTH)/third_party/webrtc/api/webrtcsession.cc', + '<(DEPTH)/third_party/webrtc/api/webrtcsession.h', + '<(DEPTH)/third_party/webrtc/api/webrtcsessiondescriptionfactory.cc', + '<(DEPTH)/third_party/webrtc/api/webrtcsessiondescriptionfactory.h', '<(DEPTH)/third_party/webrtc/media/base/audiorenderer.h', '<(DEPTH)/third_party/webrtc/media/base/capturemanager.cc', '<(DEPTH)/third_party/webrtc/media/base/capturemanager.h', @@ -298,78 +370,6 @@ '<(DEPTH)/third_party/webrtc/media/webrtc/webrtcvideoframefactory.cc', '<(DEPTH)/third_party/webrtc/media/webrtc/webrtcvideoframefactory.h', '<(DEPTH)/third_party/webrtc/media/webrtc/webrtcvoe.h', - '<(libjingle_source)/talk/app/webrtc/audiotrack.cc', - '<(libjingle_source)/talk/app/webrtc/audiotrack.h', - '<(libjingle_source)/talk/app/webrtc/datachannel.cc', - '<(libjingle_source)/talk/app/webrtc/datachannel.h', - '<(libjingle_source)/talk/app/webrtc/dtlsidentitystore.cc', - '<(libjingle_source)/talk/app/webrtc/dtlsidentitystore.h', - '<(libjingle_source)/talk/app/webrtc/dtmfsender.cc', - '<(libjingle_source)/talk/app/webrtc/dtmfsender.h', - '<(libjingle_source)/talk/app/webrtc/jsep.h', - '<(libjingle_source)/talk/app/webrtc/jsepicecandidate.cc', - '<(libjingle_source)/talk/app/webrtc/jsepicecandidate.h', - '<(libjingle_source)/talk/app/webrtc/jsepsessiondescription.cc', - '<(libjingle_source)/talk/app/webrtc/jsepsessiondescription.h', - '<(libjingle_source)/talk/app/webrtc/localaudiosource.cc', - '<(libjingle_source)/talk/app/webrtc/localaudiosource.h', - '<(libjingle_source)/talk/app/webrtc/mediaconstraintsinterface.cc', - '<(libjingle_source)/talk/app/webrtc/mediaconstraintsinterface.h', - '<(libjingle_source)/talk/app/webrtc/mediacontroller.cc', - '<(libjingle_source)/talk/app/webrtc/mediacontroller.h', - '<(libjingle_source)/talk/app/webrtc/mediastream.cc', - '<(libjingle_source)/talk/app/webrtc/mediastream.h', - '<(libjingle_source)/talk/app/webrtc/mediastreamhandler.cc', - '<(libjingle_source)/talk/app/webrtc/mediastreamhandler.h', - '<(libjingle_source)/talk/app/webrtc/mediastreaminterface.h', - '<(libjingle_source)/talk/app/webrtc/mediastreamobserver.cc', - '<(libjingle_source)/talk/app/webrtc/mediastreamobserver.h', - '<(libjingle_source)/talk/app/webrtc/mediastreamprovider.h', - '<(libjingle_source)/talk/app/webrtc/mediastreamproxy.h', - '<(libjingle_source)/talk/app/webrtc/mediastreamtrack.h', - '<(libjingle_source)/talk/app/webrtc/mediastreamtrackproxy.h', - '<(libjingle_source)/talk/app/webrtc/notifier.h', - '<(libjingle_source)/talk/app/webrtc/peerconnection.cc', - '<(libjingle_source)/talk/app/webrtc/peerconnection.h', - '<(libjingle_source)/talk/app/webrtc/peerconnectionfactory.cc', - '<(libjingle_source)/talk/app/webrtc/peerconnectionfactory.h', - '<(libjingle_source)/talk/app/webrtc/peerconnectioninterface.h', - '<(libjingle_source)/talk/app/webrtc/portallocatorfactory.cc', - '<(libjingle_source)/talk/app/webrtc/portallocatorfactory.h', - '<(libjingle_source)/talk/app/webrtc/remoteaudiosource.cc', - '<(libjingle_source)/talk/app/webrtc/remoteaudiosource.h', - '<(libjingle_source)/talk/app/webrtc/remoteaudiotrack.cc', - '<(libjingle_source)/talk/app/webrtc/remoteaudiotrack.h', - '<(libjingle_source)/talk/app/webrtc/remotevideocapturer.cc', - '<(libjingle_source)/talk/app/webrtc/remotevideocapturer.h', - '<(libjingle_source)/talk/app/webrtc/rtpreceiver.cc', - '<(libjingle_source)/talk/app/webrtc/rtpreceiver.h', - '<(libjingle_source)/talk/app/webrtc/rtpreceiverinterface.h', - '<(libjingle_source)/talk/app/webrtc/rtpsender.cc', - '<(libjingle_source)/talk/app/webrtc/rtpsender.h', - '<(libjingle_source)/talk/app/webrtc/rtpsenderinterface.h', - '<(libjingle_source)/talk/app/webrtc/sctputils.cc', - '<(libjingle_source)/talk/app/webrtc/sctputils.h', - '<(libjingle_source)/talk/app/webrtc/statscollector.cc', - '<(libjingle_source)/talk/app/webrtc/statscollector.h', - '<(libjingle_source)/talk/app/webrtc/statstypes.cc', - '<(libjingle_source)/talk/app/webrtc/statstypes.h', - '<(libjingle_source)/talk/app/webrtc/streamcollection.h', - '<(libjingle_source)/talk/app/webrtc/umametrics.h', - '<(libjingle_source)/talk/app/webrtc/videosource.cc', - '<(libjingle_source)/talk/app/webrtc/videosource.h', - '<(libjingle_source)/talk/app/webrtc/videosourceinterface.h', - '<(libjingle_source)/talk/app/webrtc/videosourceproxy.h', - '<(libjingle_source)/talk/app/webrtc/videotrack.cc', - '<(libjingle_source)/talk/app/webrtc/videotrack.h', - '<(libjingle_source)/talk/app/webrtc/videotrackrenderers.cc', - '<(libjingle_source)/talk/app/webrtc/videotrackrenderers.h', - '<(libjingle_source)/talk/app/webrtc/webrtcsdp.cc', - '<(libjingle_source)/talk/app/webrtc/webrtcsdp.h', - '<(libjingle_source)/talk/app/webrtc/webrtcsession.cc', - '<(libjingle_source)/talk/app/webrtc/webrtcsession.h', - '<(libjingle_source)/talk/app/webrtc/webrtcsessiondescriptionfactory.cc', - '<(libjingle_source)/talk/app/webrtc/webrtcsessiondescriptionfactory.h', '<(libjingle_source)/talk/session/media/audiomonitor.cc', '<(libjingle_source)/talk/session/media/audiomonitor.h', '<(libjingle_source)/talk/session/media/bundlefilter.cc',
diff --git a/tools/android/loading/device_setup.py b/tools/android/loading/device_setup.py index c3847078..49869577 100644 --- a/tools/android/loading/device_setup.py +++ b/tools/android/loading/device_setup.py
@@ -16,12 +16,19 @@ sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'catapult', 'devil')) from devil.android import device_utils +from devil.android import forwarder from devil.android.sdk import intent sys.path.append(os.path.join(_SRC_DIR, 'build', 'android')) from pylib import constants from pylib import flag_changer +sys.path.append(os.path.join(_SRC_DIR, 'tools', 'perf')) +from chrome_telemetry_build import chromium_config + +sys.path.append(chromium_config.GetTelemetryDir()) +from telemetry.internal.util import webpagereplay + import devtools_monitor DEVTOOLS_PORT = 9222 @@ -104,12 +111,58 @@ @contextlib.contextmanager +def WprHost(device, wpr_archive_path, record=False): + """Launches web page replay host. + + Args: + device: Android device. + wpr_archive_path: host sided WPR archive's path. + record: Enables or disables WPR archive recording. + + Returns: + Additional flags list that may be used for chromium to load web page through + the running web page replay host. + """ + assert device + if wpr_archive_path == None: + yield [] + return + + wpr_server_args = ['--use_closest_match'] + if record: + wpr_server_args.append('--record') + if os.path.exists(wpr_archive_path): + os.remove(wpr_archive_path) + else: + assert os.path.exists(wpr_archive_path) + wpr_server = webpagereplay.ReplayServer(wpr_archive_path, + '127.0.0.1', 0, 0, None, wpr_server_args) + ports = wpr_server.StartServer()[:-1] + host_http_port = ports[0] + host_https_port = ports[1] + + forwarder.Forwarder.Map([(0, host_http_port), (0, host_https_port)], device) + device_http_port = forwarder.Forwarder.DevicePortForHostPort(host_http_port) + device_https_port = forwarder.Forwarder.DevicePortForHostPort(host_https_port) + + try: + yield [ + '--host-resolver-rules="MAP * 127.0.0.1,EXCLUDE localhost"', + '--testing-fixed-http-port={}'.format(device_http_port), + '--testing-fixed-https-port={}'.format(device_https_port)] + finally: + forwarder.Forwarder.UnmapDevicePort(device_http_port, device) + forwarder.Forwarder.UnmapDevicePort(device_https_port, device) + wpr_server.StopServer() + +@contextlib.contextmanager def DeviceConnection(device, package=DEFAULT_CHROME_PACKAGE, hostname=DEVTOOLS_HOSTNAME, port=DEVTOOLS_PORT, host_exe='out/Release/chrome', - host_profile_dir=None): + host_profile_dir=None, + additional_flags=None): """Context for starting recording on a device. Sets up and restores any device and tracing appropriately @@ -122,6 +175,7 @@ host_exe: The binary to execute when running on the host. host_profile_dir: The profile dir to use when running on the host (if None, a fresh profile dir will be used). + additional_flags: Additional chromium arguments. Returns: A context manager type which evaluates to a DevToolsConnection. @@ -131,6 +185,8 @@ new_flags = ['--disable-fre', '--enable-test-events', '--remote-debugging-port=%d' % port] + if additional_flags != None: + new_flags.extend(additional_flags) if device: _SetUpDevice(device, package_info) with FlagReplacer(device, command_line_path, new_flags):
diff --git a/tools/android/loading/run_sandwich.py b/tools/android/loading/run_sandwich.py index 7b688a7..8286c3c 100755 --- a/tools/android/loading/run_sandwich.py +++ b/tools/android/loading/run_sandwich.py
@@ -160,6 +160,10 @@ action='store_true', help='Clear HTTP cache before start,' + 'save cache before exit.') + parser.add_argument('--wpr-archive', default=None, type=str, + help='Web page replay archive to load job\'s urls from.') + parser.add_argument('--wpr-record', default=False, action='store_true', + help='Record web page replay archive.') args = parser.parse_args() try: @@ -171,21 +175,26 @@ job_urls = _ReadUrlsFromJobDescription(args.job) device = device_utils.DeviceUtils.HealthyDevices()[0] - pages_loaded = 0 - for iteration in xrange(args.repeat): - for url in job_urls: - with device_setup.DeviceConnection(device) as connection: - if iteration == 0 and pages_loaded == 0 and args.save_cache: - connection.ClearCache() - page_track.PageTrack(connection) - tracing_track = tracing.TracingTrack(connection, - categories='blink,cc,netlog,renderer.scheduler,toplevel,v8') - connection.SetUpMonitoring() - connection.SendAndIgnoreResponse('Page.navigate', {'url': url}) - connection.StartMonitoring() - pages_loaded += 1 - _SaveChromeTrace(tracing_track.ToJsonDict(), args.output, - str(pages_loaded)) + with device_setup.WprHost(device, + args.wpr_archive, + args.wpr_record) as additional_flags: + pages_loaded = 0 + for iteration in xrange(args.repeat): + for url in job_urls: + with device_setup.DeviceConnection( + device=device, + additional_flags=additional_flags) as connection: + if iteration == 0 and pages_loaded == 0 and args.save_cache: + connection.ClearCache() + page_track.PageTrack(connection) + tracing_track = tracing.TracingTrack(connection, + categories='blink,cc,netlog,renderer.scheduler,toplevel,v8') + connection.SetUpMonitoring() + connection.SendAndIgnoreResponse('Page.navigate', {'url': url}) + connection.StartMonitoring() + pages_loaded += 1 + _SaveChromeTrace(tracing_track.ToJsonDict(), args.output, + str(pages_loaded)) if args.save_cache: # Move Chrome to background to allow it to flush the index.
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc index cecf7df..17de4c6 100644 --- a/ui/events/blink/input_handler_proxy.cc +++ b/ui/events/blink/input_handler_proxy.cc
@@ -123,28 +123,34 @@ } cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) { + cc::ScrollStateData scroll_state_data; switch (event.type) { case WebInputEvent::GestureScrollBegin: - return cc::ScrollState(0, 0, event.x, event.y, 0, 0, true, false, false); + scroll_state_data.start_position_x = event.x; + scroll_state_data.start_position_y = event.y; + scroll_state_data.is_beginning = true; + break; case WebInputEvent::GestureFlingStart: - return cc::ScrollState( - 0, 0, event.x, event.y, event.data.flingStart.velocityX, - event.data.flingStart.velocityX, true, true, false); + scroll_state_data.velocity_x = event.data.flingStart.velocityX; + scroll_state_data.velocity_y = event.data.flingStart.velocityY; + scroll_state_data.is_in_inertial_phase = true; + break; case WebInputEvent::GestureScrollUpdate: - return cc::ScrollState(-event.data.scrollUpdate.deltaX, - -event.data.scrollUpdate.deltaY, event.x, event.y, - event.data.scrollUpdate.velocityX, - event.data.scrollUpdate.velocityY, - event.data.scrollUpdate.inertial, false, false); + scroll_state_data.delta_x = -event.data.scrollUpdate.deltaX; + scroll_state_data.delta_y = -event.data.scrollUpdate.deltaY; + scroll_state_data.velocity_x = event.data.scrollUpdate.velocityX; + scroll_state_data.velocity_y = event.data.scrollUpdate.velocityY; + scroll_state_data.is_in_inertial_phase = event.data.scrollUpdate.inertial; + break; case WebInputEvent::GestureScrollEnd: - return cc::ScrollState(0, 0, event.x, event.y, 0, 0, false, false, true); case WebInputEvent::GestureFlingCancel: - return cc::ScrollState(0, 0, event.x, event.y, 0, 0, false, true, true); - + scroll_state_data.is_ending = true; + break; default: NOTREACHED(); - return cc::ScrollState(0, 0, 0, 0, 0, 0, false, false, false); + break; } + return cc::ScrollState(scroll_state_data); } void ReportInputEventLatencyUma(const WebInputEvent& event, @@ -464,8 +470,11 @@ break; } } else { - cc::ScrollState scroll_state_begin(0, 0, wheel_event.x, wheel_event.y, 0, 0, - true, false, false); + cc::ScrollStateData scroll_state_begin_data; + scroll_state_begin_data.start_position_x = wheel_event.x; + scroll_state_begin_data.start_position_y = wheel_event.y; + scroll_state_begin_data.is_beginning = true; + cc::ScrollState scroll_state_begin(scroll_state_begin_data); cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin( &scroll_state_begin, cc::InputHandler::WHEEL); @@ -478,16 +487,21 @@ "InputHandlerProxy::handle_input wheel scroll", TRACE_EVENT_SCOPE_THREAD, "deltaX", scroll_delta.x(), "deltaY", scroll_delta.y()); - cc::ScrollState scroll_state_update(scroll_delta.x(), scroll_delta.y(), - wheel_event.x, wheel_event.y, 0, 0, - false, false, false); + + cc::ScrollStateData scroll_state_update_data; + scroll_state_update_data.delta_x = scroll_delta.x(); + scroll_state_update_data.delta_y = scroll_delta.y(); + scroll_state_update_data.start_position_x = wheel_event.x; + scroll_state_update_data.start_position_y = wheel_event.y; + cc::ScrollState scroll_state_update(scroll_state_update_data); scroll_result = input_handler_->ScrollBy(&scroll_state_update); HandleOverscroll(gfx::Point(wheel_event.x, wheel_event.y), scroll_result); - cc::ScrollState scroll_state_end(0, 0, wheel_event.x, wheel_event.y, - 0, 0, false, false, true); + cc::ScrollStateData scroll_state_end_data; + scroll_state_end_data.is_ending = true; + cc::ScrollState scroll_state_end(scroll_state_end_data); input_handler_->ScrollEnd(&scroll_state_end); result = scroll_result.did_scroll ? DID_HANDLE : DROP_EVENT; @@ -1026,9 +1040,9 @@ bool had_fling_animation = !!fling_curve_; if (had_fling_animation && fling_parameters_.sourceDevice == blink::WebGestureDeviceTouchscreen) { - cc::ScrollState scroll_state(0, 0, fling_parameters_.point.x, - fling_parameters_.point.y, 0, 0, false, true, - true); + cc::ScrollStateData scroll_state_data; + scroll_state_data.is_ending = true; + cc::ScrollState scroll_state(scroll_state_data); input_handler_->ScrollEnd(&scroll_state); TRACE_EVENT_ASYNC_END0( "input", @@ -1148,10 +1162,13 @@ break; case blink::WebGestureDeviceTouchscreen: { clipped_increment = ToClientScrollIncrement(clipped_increment); - cc::ScrollState scroll_state( - clipped_increment.width, clipped_increment.height, - fling_parameters_.point.x, fling_parameters_.point.y, - clipped_velocity.width, clipped_velocity.height, false, true, false); + cc::ScrollStateData scroll_state_data; + scroll_state_data.delta_x = clipped_increment.width; + scroll_state_data.delta_y = clipped_increment.height; + scroll_state_data.velocity_x = clipped_velocity.width; + scroll_state_data.velocity_y = clipped_velocity.height; + scroll_state_data.is_in_inertial_phase = true; + cc::ScrollState scroll_state(scroll_state_data); cc::InputHandlerScrollResult scroll_result = input_handler_->ScrollBy(&scroll_state); HandleOverscroll(fling_parameters_.point, scroll_result);
diff --git a/ui/message_center/cocoa/settings_controller_unittest.mm b/ui/message_center/cocoa/settings_controller_unittest.mm index c686fcfe..a1291b7 100644 --- a/ui/message_center/cocoa/settings_controller_unittest.mm +++ b/ui/message_center/cocoa/settings_controller_unittest.mm
@@ -37,8 +37,7 @@ const std::string& login_info) { return new NotifierGroup(gfx::Image(), base::UTF8ToUTF16(name), - base::UTF8ToUTF16(login_info), - true); + base::UTF8ToUTF16(login_info)); } Notifier* NewNotifier(const std::string& id,
diff --git a/ui/message_center/fake_notifier_settings_provider.cc b/ui/message_center/fake_notifier_settings_provider.cc index 79c153a8..94651496 100644 --- a/ui/message_center/fake_notifier_settings_provider.cc +++ b/ui/message_center/fake_notifier_settings_provider.cc
@@ -28,8 +28,7 @@ NotifierGroupItem item; item.group = new NotifierGroup(gfx::Image(), base::UTF8ToUTF16("Fake name"), - base::UTF8ToUTF16("fake@email.com"), - true); + base::UTF8ToUTF16("fake@email.com")); item.notifiers = notifiers; items_.push_back(item); }
diff --git a/ui/message_center/notifier_settings.cc b/ui/message_center/notifier_settings.cc index 2654611..72a378b 100644 --- a/ui/message_center/notifier_settings.cc +++ b/ui/message_center/notifier_settings.cc
@@ -63,9 +63,8 @@ NotifierGroup::NotifierGroup(const gfx::Image& icon, const base::string16& name, - const base::string16& login_info, - size_t index) - : icon(icon), name(name), login_info(login_info), index(index) {} + const base::string16& login_info) + : icon(icon), name(name), login_info(login_info) {} NotifierGroup::~NotifierGroup() {}
diff --git a/ui/message_center/notifier_settings.h b/ui/message_center/notifier_settings.h index 95646af..43e20326 100644 --- a/ui/message_center/notifier_settings.h +++ b/ui/message_center/notifier_settings.h
@@ -8,6 +8,7 @@ #include <stddef.h> #include <string> +#include <vector> #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -114,8 +115,7 @@ struct MESSAGE_CENTER_EXPORT NotifierGroup { NotifierGroup(const gfx::Image& icon, const base::string16& name, - const base::string16& login_info, - size_t index); + const base::string16& login_info); ~NotifierGroup(); // Icon of a notifier group. @@ -127,10 +127,6 @@ // More display information about the notifier group. base::string16 login_info; - // Unique identifier for the notifier group so that they can be selected in - // the UI. - const size_t index; - private: DISALLOW_COPY_AND_ASSIGN(NotifierGroup); }; @@ -155,7 +151,7 @@ // for the clients of this module. class MESSAGE_CENTER_EXPORT NotifierSettingsProvider { public: - virtual ~NotifierSettingsProvider() {}; + virtual ~NotifierSettingsProvider() {} // Sets the delegate. virtual void AddObserver(NotifierSettingsObserver* observer) = 0;
diff --git a/ui/views/mus/screen_mus.cc b/ui/views/mus/screen_mus.cc index 354af1c4..5b22354 100644 --- a/ui/views/mus/screen_mus.cc +++ b/ui/views/mus/screen_mus.cc
@@ -78,7 +78,7 @@ void ScreenMus::Init(mojo::Shell* shell) { gfx::Screen::SetScreenInstance(this); - shell->ConnectToService("mojo:mus", &display_manager_); + shell->ConnectToInterface("mojo:mus", &display_manager_); display_manager_->AddObserver( display_manager_observer_binding_.CreateInterfacePtrAndBind());
diff --git a/ui/views/mus/surface_binding.cc b/ui/views/mus/surface_binding.cc index 90a09ba..c9e897a 100644 --- a/ui/views/mus/surface_binding.cc +++ b/ui/views/mus/surface_binding.cc
@@ -124,7 +124,7 @@ } void SurfaceBinding::PerConnectionState::Init() { - shell_->ConnectToService("mojo:mus", &gpu_); + shell_->ConnectToInterface("mojo:mus", &gpu_); } // SurfaceBinding --------------------------------------------------------------